Documentation ¶
Overview ¶
Package config takes care of the configuration file parsing.
Index ¶
- Constants
- func ConfigDir() string
- func ConfigFilePath() string
- func DataDir() string
- func LocalChecksumPath(parserName string) string
- func ParserPath(parserName string) string
- func ParserURI(serverURL, parserName string) string
- func ParsersDir() string
- func RemoteChecksumsPath(serverURL string) string
- func RemoteParserPath(parserName string) string
- func TempPath(parserName string) string
- type Config
Constants ¶
const ( ConfigFolder = "srctool" // Configuration folder name DataFolder = "srctool" // Data folder name ParsersFolder = "parsers" // Parsers folder name ConfigFileName = "srctool.conf" // Configuration file name ChecksumFileName = "MD5SUM" // Checksum file name // DefaultConfigDir is the default configuration directoy when // $XDG_CONFIG_HOME is not set. DefaultConfigDir = ".config" // DefaultDataDir is the default data directoy when $XDG_DATA_HOME // is not set. DefaultDataDir = ".local/share" )
Configuration constants
Variables ¶
This section is empty.
Functions ¶
func ConfigFilePath ¶
func ConfigFilePath() string
ConfigFilePath returns the path of the configuration file.
func LocalChecksumPath ¶
LocalChecksumPath returns the path of the checksum file for a given parser.
func ParserPath ¶
ParserPath return the local path of a parser.
func RemoteChecksumsPath ¶
RemoteChecksumsPath returns the path of the remotes checksums file.
func RemoteParserPath ¶
RemoteParserPath returns the remote parser path.
Types ¶
type Config ¶
type Config struct {
DownloadServerURL string `json:"download_server_url"`
}
Config holds the configuration of srctool.
func New ¶
New creates a new Config initialized with the values defined in the configuration file located in $XDG_CONFIG_HOME/srctool/srctool.conf. If $XDG_CONFIG_HOME is not set, it uses the directory "$HOME/.config/" as config home. If some files or directories do not already exist, it creates them automatically.