Documentation ¶
Overview ¶
Package config provides access to the configuration models required by the rest of the modules.
Index ¶
- Constants
- type Analytics
- type Authentication
- type Config
- func (config *Config) AuthenticationFilePath() string
- func (config *Config) AuthenticationIsEnabled() bool
- func (config *Config) BaseFolder() string
- func (config *Config) CertificateDirectory() string
- func (config *Config) CertificateFilePaths() (certificateFilePath, keyFilePath string, created bool)
- func (config *Config) Filepath() string
- func (config *Config) GetAuthenticationUserStore() auth.SecretProvider
- func (config *Config) Load() (*Config, error)
- func (config *Config) MetaDataFolder() string
- func (config *Config) Save() (*Config, error)
- func (config *Config) TemplatesFolder() string
- func (config *Config) ThemeFolder() string
- func (config *Config) ThumbnailFolder() string
- func (config *Config) ThumbnailIndexFilePath() string
- type Conversion
- type DOCXConversion
- type GoogleAnalytics
- type HTTP
- type HTTPS
- type Indexing
- type JSONSerializer
- type LiveReload
- type Server
- type TCPBinding
- type ThumbnailConversion
- type UserInformation
- type Web
Constants ¶
const ( MetaDataFolderName = ".allmark" FilesDirectoryName = "files" ConfigurationFileName = "config" ThemeFolderName = "theme" TemplatesFolderName = "templates" ThumbnailIndexFileName = "thumbnail.index" ThumbnailsFolderName = "thumbnails" SSLCertsFolderName = "certs" )
Global configuration constants.
const ( DefaultDomainName = "localhost" DefaultHTTPPortEnabled = true DefaultHTTPSPortEnabled = false DefaultHTTPSCertName = "cert.pem" DefaultHTTPSKeyName = "cert.key" DefaultForceHTTPS = false DefaultLanguage = "en" DefaultLogLevel = loglevel.Error DefaultIndexingEnabled = false DefaultIndexingIntervalInSeconds = 60 DefaultLiveReloadEnabled = false DefaultConversionDocxEnabled = true DefaultAuthenticationEnabled = false DefaultUserStoreFileName = "users.htpasswd" )
Global default values.
const (
DefaultConversionToolPath = "pandoc"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analytics ¶
type Analytics struct { Enabled bool GoogleAnalytics GoogleAnalytics }
Analytics defines the web-analytics parameters of the web-server.
type Authentication ¶ added in v0.10.0
type Authentication struct { // Enabled is flag indicating whether authentication is enabled. Enabled bool // UserStoreFileName defines the file name for the authentication user-store file (e.g. "users.htpasswd"). UserStoreFileName string }
Authentication contains authentication settings.
type Config ¶
type Config struct { Server Server Web Web Conversion Conversion LogLevel string Indexing Indexing LiveReload LiveReload Analytics Analytics // contains filtered or unexported fields }
Config is the main configuration model for all parts of allmark.
func Get ¶
Get tries to locate a Config in the specified baseFolder and return it. If no configuration was found in the specified folder it will check the users home-directory for a Config. If no configuration was found in the supplied baseFolder and no global config in the users home-directory Get will return a default configuration.
func (*Config) AuthenticationFilePath ¶ added in v0.10.0
AuthenticationFilePath returns the path of the authentication file.
func (*Config) AuthenticationIsEnabled ¶ added in v0.10.0
AuthenticationIsEnabled get a flag indicating if authentication is enabled.
func (*Config) BaseFolder ¶
BaseFolder returns the path of the base folder of the current configuration model.
func (*Config) CertificateDirectory ¶ added in v0.10.0
CertificateDirectory returns the path of the SSL certificates directory in the meta-data folder.
func (*Config) CertificateFilePaths ¶ added in v0.10.0
func (config *Config) CertificateFilePaths() (certificateFilePath, keyFilePath string, created bool)
CertificateFilePaths returns the SSL certificate and key file paths. If none are configured or the configured ones don't exist it will create new ones and return the paths of the newly generates certificate/key pair.
func (*Config) Filepath ¶
Filepath returns the path of the serialized version of the current configuration model.
func (*Config) GetAuthenticationUserStore ¶ added in v0.10.0
func (config *Config) GetAuthenticationUserStore() auth.SecretProvider
GetAuthenticationUserStore returns a digest-access authentication secret provider function that uses the configured authentication file.
func (*Config) MetaDataFolder ¶
MetaDataFolder returns the path of the meta-data folder.
func (*Config) TemplatesFolder ¶
TemplatesFolder returns the path of the templates folder.
func (*Config) ThemeFolder ¶
ThemeFolder returns the path of the theme folder.
func (*Config) ThumbnailFolder ¶
ThumbnailFolder returns the path of the thumbnail folder.
func (*Config) ThumbnailIndexFilePath ¶
ThumbnailIndexFilePath returns the path of the thumbnail index file.
type Conversion ¶
type Conversion struct { DOCX DOCXConversion Thumbnails ThumbnailConversion }
Conversion defines the rich-text and thumbnail conversion paramters.
func (Conversion) EndpointBinding ¶ added in v0.10.0
func (c Conversion) EndpointBinding() *TCPBinding
EndpointBinding returns the TCPBinding of the conversion endpoint
type DOCXConversion ¶ added in v0.10.0
type DOCXConversion struct {
Enabled bool
}
DOCXConversion contains rich-text (DOCX) conversion parameters.
func (DOCXConversion) IsEnabled ¶ added in v0.10.0
func (docx DOCXConversion) IsEnabled() bool
IsEnabled returns a flag indicating if rich-text conversion is enabled or not. Rich-text conversion can only be enabled if the conversion tool was found in the PATH on startup.
func (DOCXConversion) Tool ¶ added in v0.10.0
func (docx DOCXConversion) Tool() string
Tool returns the path of the external rich-text conversion tool (pandoc) used to create Rich-text documents from repository items.
type GoogleAnalytics ¶
GoogleAnalytics contains the Google Analytics realted parameters for the web-analytics section.
type HTTP ¶ added in v0.10.0
type HTTP struct { Enabled bool Bindings []*TCPBinding }
HTTP contains the configuration parameters for HTTP server endpoint.
type HTTPS ¶ added in v0.10.0
HTTPS contains the configuration parameters for a HTTPS server endpoint.
func (*HTTPS) HTTPSIsForced ¶ added in v0.10.0
HTTPSIsForced indicates whether HTTPS is forced or not.
type JSONSerializer ¶
type JSONSerializer struct{}
func NewJSONSerializer ¶
func NewJSONSerializer() *JSONSerializer
func (JSONSerializer) DeserializeConfig ¶
func (JSONSerializer) DeserializeConfig(reader io.Reader) (*Config, error)
func (JSONSerializer) SerializeConfig ¶
func (JSONSerializer) SerializeConfig(writer io.Writer, config *Config) error
type LiveReload ¶ added in v0.10.0
type LiveReload struct {
Enabled bool
}
LiveReload defines the live-reload capabilities.
type Server ¶
type Server struct { ThemeFolderName string DomainName string HTTP HTTP HTTPS HTTPS Authentication Authentication }
Server contains web-server related parameters such as the domain-name, theme-folder and HTTP/HTTPs bindings.
type TCPBinding ¶ added in v0.10.0
TCPBinding contains all required parameters for a tcp4 or tcp6 address binding.
func (*TCPBinding) AssignFreePort ¶ added in v0.10.0
func (binding *TCPBinding) AssignFreePort()
AssignFreePort locates a free port and assigns it the the current binding.
func (*TCPBinding) GetTCPAddress ¶ added in v0.10.0
func (binding *TCPBinding) GetTCPAddress() net.TCPAddr
GetTCPAddress returns a net.TCPAddress object of the current TCP binding.
func (*TCPBinding) String ¶ added in v0.10.0
func (binding *TCPBinding) String() string
type ThumbnailConversion ¶
ThumbnailConversion defines the image-thumbnail conversion capabilities.
type UserInformation ¶
type UserInformation struct { Name string Email string URL string GooglePlusHandle string TwitterHandle string FacebookHandle string }
UserInformation contains user-related properties such as the Name and Email address.
type Web ¶
type Web struct { DefaultLanguage string DefaultAuthor string Publisher UserInformation Authors map[string]UserInformation }
Web contains all web-site related properties such as the language, authors and publisher information.