config

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct{ *viper.Viper }

Config wraps viper.Viper

func InitConfig

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

InitConfig load config file. It try loading config in this order:

  • path (specify `-c` option)
  • $XDG_CONFIG_HOME/legsc/conf.toml
  • xdg_config_dir/legsc/conf.toml (where xdg_config_dir is in $XDG_CONFIG_DIRS)
  • ~/.config/legsc/conf.toml
  • ~/.legsc/conf.toml

func (*Config) Save

func (c *Config) Save(key string, value interface{}) error

Save set a parameter of config data by key and value. And this method save configuration to file.

func (*Config) Write

func (c *Config) Write() (err error)

Write save config to file, and change permission.

Jump to

Keyboard shortcuts

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