Documentation ¶
Index ¶
- Constants
- Variables
- func CopyBlankToFilename(conf *Config, filename string) error
- func CopyBrogBinaries() []error
- type Brog
- func (b *Brog) Close() error
- func (l Brog) Debug(format string, args ...interface{})
- func (l Brog) Err(format string, args ...interface{})
- func (b *Brog) ListenAndServe() error
- func (l Brog) Ok(format string, args ...interface{})
- func (l Brog) Warn(format string, args ...interface{})
- func (l Brog) Watch(format string, args ...interface{})
- type Config
Constants ¶
const ( DebugVerbosity = "debug" WatchVerbosity = "watch" InfoVerbosity = "info" WarnVerbosity = "warn" ErrorVerbosity = "error" )
Verbosity levels accepted by brog
const (
// ConfigFilename where to find the Brog config file.
ConfigFilename = "brog_config.json"
)
const (
// JSONIndentCount how many spaces to indent the config file
JSONIndentCount = 3
)
Variables ¶
var ( DefaultProdPortNumber = 80 DefaultDevelPortNumber = 3000 DefaultHostname = "localhost" DefaultMaxCPUs = runtime.NumCPU() DefaultTemplatePath = "templates/" DefaultPostPath = "posts/" DefaultAssetPath = "assets/" DefaultPostFileExt = ".md" DefaultLogFilename = "brog.log" DefaultLogVerbosity = "watch" DefaultConsoleVerbosity = "watch" DefaultRewriteInvalid = true // True so that brog has stable default DefaultRewriteMissing = true // True so that brog has stable default DefaultMultilingual = false // False because blogs are usually unilingual DefaultLanguages = []string{"en"} )
Defaults for Brog's configuration.
Functions ¶
func CopyBlankToFilename ¶
CopyBlankToFilename creates a blank post at the given filename, under the asset path specified by conf
func CopyBrogBinaries ¶
func CopyBrogBinaries() []error
CopyBrogBinaries writes the in-memory brog assets to the current working directory, effectively creating a brog structure that `brog server` can use to serve content.
Types ¶
type Brog ¶
type Brog struct { Config *Config // contains filtered or unexported fields }
Brog loads its configuration file, provide logging facility, serves brog posts and watches for changes in posts and templates.
func PrepareBrog ¶
PrepareBrog creates a Brog instance, loading it's configuration from a file named `ConfigFilename` that must lie at the current working directory. It creates a logging file at the location specified in the config file. If anything goes wrong during that process, it will return an error explaining where it happened.
func (*Brog) ListenAndServe ¶
ListenAndServe starts watching the path specified in `ConfigFilename` for changes and starts serving brog's content, again according to the settings in `ConfigFilename`.
type Config ¶
type Config struct { ProdPortNumber int `json:"prodPortNumber"` DevelPortNumber int `json:"develPortNumber"` Hostname string `json:"hostName"` MaxCPUs int `json:"maxCpus"` TemplatePath string `json:"templatePath"` PostPath string `json:"postPath"` AssetPath string `json:"assetPath"` PostFileExt string `json:"postFileExtension"` LogFilename string `json:"logFilename"` LogFileVerbosity string `json:"logFileVerbosity"` ConsoleVerbosity string `json:"consoleVerbosity"` RewriteInvalid bool `json:"rewriteInvalid"` RewriteMissing bool `json:"rewriteMissing"` Multilingual bool `json:"multilingual"` Languages []string `json:"languages"` }
Config contains all the settings that a Brog uses to watch and create and serve posts, log events and execute in general.