config

package
v0.0.0-...-8f60130 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Windows          = "windows"
	WindowsAppData   = "AppData"
	WindowsRoaming   = "Roaming"
	WindowsCrateName = "Crate"
	UnixCrateName    = ".crate"
	DatabaseName     = "filemeta.db"
	ConfigName       = "config.yaml"
	LogDirName       = "logs"
	LogFileName      = "events.log"
)

Variables

This section is empty.

Functions

func ClearPathCache

func ClearPathCache()

Helper function to clear the cache to force lookup

func CrateConfigPath

func CrateConfigPath() (string, error)

Returns the config path and performs initialization if not done

func CrateDatabasePath

func CrateDatabasePath() (string, error)

Returns the database path and performs initialization if not done.

func CrateDirectory

func CrateDirectory() (string, error)

Figures out the configuration and data path and returns it or an error Configuration and data are in the HOME directory of the current user

func CrateLoggingPath

func CrateLoggingPath() (string, error)

Returns the logging path and performs initialization if not exists

func InitializeConfigFile

func InitializeConfigFile(path string) error

Creates a Config YAML file with the default settings at the specified path

func InitializeCrateDirectory

func InitializeCrateDirectory(path string) error

Creates the Crate directory and initializes it with default files

func PathExists

func PathExists(path string) (bool, error)

Helper function to check if a path exists on the file system

Types

type Config

type Config struct {
	Debug  bool     `yaml:debug,omitempty`  // default false
	Notify []string `yaml:notify,omitempty` // default []
	Level  string   `yaml:level,omitempty`  // default INFO
}

func Load

func Load(path string) (*Config, error)

Load a Config by loading a YAML file, second of two ways to create a config

func New

func New() *Config

Create a New Config with default values, one of two ways to create a config

func (*Config) Dump

func (conf *Config) Dump(path string) error

Dump a Config to a YAML file, primary way of saving a config to disk

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL