Documentation
¶
Overview ¶
Package conffile wraps the read and write of configuration files
Index ¶
- type File
- type Opt
- func WithAppDir(unixDir, winDir, name string, force bool) Opt
- func WithDirName(dir, name string) Optdeprecated
- func WithEnvDir(envVar, name string) Opt
- func WithEnvFile(envVar string) Opt
- func WithFullname(fullname string) Opt
- func WithHomeDir(dir, name string, force bool) Opt
- func WithPerms(perms int) Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
type Opt ¶
type Opt func(*File)
func WithAppDir ¶ added in v0.11.2
WithAppDir determines the filename from the XDG or Windows specification. By default, this is based in $HOME/.config on Linux and %APPDATA% on Windows. If the file does not exist, this will set the filename only if "force" is true.
func WithDirName
deprecated
WithDirName determines the filename from a subdirectory in the user's HOME.
Deprecated: Replace with WithHomeDir
func WithEnvDir ¶ added in v0.4.4
WithEnvDir sets the fullname to the environment value + filename if the environment variable is defined.
func WithEnvFile ¶ added in v0.4.4
WithEnvFile sets the fullname to the environment value if defined.
func WithFullname ¶
WithFullname specifies the filename. This will always set the filename even if the file does not exist.
func WithHomeDir ¶ added in v0.11.2
WithHomeDir determines the filename from a subdirectory in the user's HOME e.g. dir=".app", name="config.json", sets the fullname to "$HOME/.app/config.json". If the file does not exist, this will set the filename only if "force" is true.