Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config provides an easy way to read and write configuration files for desktop applications.
Config files are stored in the appropriate location (per os.UserConfigDir()), and automatically marshalled to and from YAML.
func Load ¶ added in v1.1.0
Load is a convenience method that creates a new Config with the given options, and then immediately loads the config into the target struct.
func New ¶
New creates a new Config that can be used to load and save configuration information. Options can be passed to customise behaviour, but the defaults are designed to be usable out of the box.
func (*Config) Directory ¶ added in v1.2.0
Directory returns the directory where the config file is stored.
type Option ¶
type Option func(*options)
An Option alters the default configuration of the config provider.
func DirectoryName ¶
DirectoryName changes the name of the directory that the config file should be stored in.
This is usually the application's name, and if not specified will default to os.Args[0].
func FileName ¶
FileName changes the name of the file that the config is stored in.
If not specified, defaults to "config.yml".
func Permissions ¶
Permissions sets the filesystem permissions that will be set on newly created directories and files. Existing permissions will not be modified.
If not specified, defaults to 0700 for directories and 0600 for files.