Documentation ¶
Overview ¶
Package config is resposible for finding, parsing and merging the HTTPMS user configuration with the default. Configuration locations should be different depending on the host OS.
Linux/BSD configurations should be in $HOME/.httpms/config.json Windows configurations should be in %APPDATA%/httpms/config.json
Index ¶
Constants ¶
const ( // ConfigName contains the name of the actual configuration file. This is the one // the user is supposed to change. ConfigName = "config.json" )
Variables ¶
This section is empty.
Functions ¶
func CopyDefaultOverUser ¶ added in v1.2.0
func CopyDefaultOverUser() error
CopyDefaultOverUser will create (or replace if neccessery) the user configuration using the default config new config.
func UserConfigExists ¶ added in v1.2.0
func UserConfigExists() bool
UserConfigExists returns true if the user configuration is present and in order. Otherwise false.
func UserConfigPath ¶ added in v1.2.0
func UserConfigPath() string
UserConfigPath returns the full path to the place where the user's configuration file should be
Types ¶
type Auth ¶ added in v1.0.2
type Auth struct { User string `json:"user,omitempty"` Password string `json:"password,omitempty"` Secret string `json:"secret"` }
Auth represents a configuration HTTP Basic authentication
type Config ¶
type Config struct { Listen string `json:"listen,omitempty"` SSL bool `json:"ssl,omitempty"` SSLCertificate Cert `json:"ssl_certificate,omitempty"` Auth bool `json:"basic_authenticate,omitempty"` Authenticate Auth `json:"authentication,omitempty"` Libraries []string `json:"libraries,omitempty"` LibraryScan ScanSection `json:"library_scan,omitempty"` UserPath string `json:"user_path,omitempty"` LogFile string `json:"log_file,omitempty"` SqliteDatabase string `json:"sqlite_database,omitempty"` Gzip bool `json:"gzip,omitempty"` ReadTimeout int `json:"read_timeout,omitempty"` WriteTimeout int `json:"write_timeout,omitempty"` MaxHeadersSize int `json:"max_header_bytes,omitempty"` DownloadArtwork bool `json:"download_artwork,omitempty"` }
Config contains representation for everything in config.json
func FindAndParse ¶ added in v1.2.0
FindAndParse actually finds the configuration file, parsing it and merging it on top the default configuration.
type ScanSection ¶ added in v1.0.2
type ScanSection struct { FilesPerOperation int64 `json:"files_per_operation,omitempty"` SleepPerOperation time.Duration `json:"sleep_after_operation,omitempty"` InitialWait time.Duration `json:"initial_wait_duration,omitempty"` }
ScanSection is used for merging the two configs. Its purpose is to essentially hold the default values for its properties.
func (*ScanSection) UnmarshalJSON ¶ added in v1.0.2
func (ss *ScanSection) UnmarshalJSON(input []byte) error
UnmarshalJSON parses a JSON and populets its ScanSection. Satisfies the Unmrashaller interface.