Documentation
¶
Index ¶
- func GetConfigPath(key string, path ...string) string
- type Configer
- type Core
- func (c *Core) AddConfigPath(in string)
- func (c *Core) GetConfig() *viper.Viper
- func (c *Core) ReadConfig() (*viper.Viper, error)
- func (c *Core) SetAutomaticEnv(prefix, oldStr, newStr string)
- func (c *Core) SetConfigName(in string)
- func (c *Core) SetConfigType(in string)
- func (c *Core) SetDefault(key string, value interface{}) *Core
- func (c *Core) WriteConfig() error
- func (c *Core) WriteConfigAs(path string) error
- type FileType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigPath ¶
Types ¶
type Configer ¶
type Configer struct {
// contains filtered or unexported fields
}
var ( //Config : 設定檔變數 Config *Configer )
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func NewCore ¶
參數依序為: / 1. 設定檔類型 (支援 yaml、yml、json、properties、ini、hcl、toml) / 2. 檔案名稱 (例如檔名為 config.yaml 就輸入 config) / 3. 後續皆為檔案路徑,可以支援多個路徑尋找檔案
func NewCoreWithData ¶
func (*Core) AddConfigPath ¶
func (*Core) SetAutomaticEnv ¶
func (*Core) SetConfigName ¶
func (*Core) SetConfigType ¶
func (*Core) SetDefault ¶
func (*Core) WriteConfig ¶
func (*Core) WriteConfigAs ¶
Click to show internal directories.
Click to hide internal directories.