Added migrations
This commit is contained in:
parent
4a16acc87e
commit
5b18009658
34 changed files with 929 additions and 154 deletions
|
|
@ -17,10 +17,10 @@ type Config struct {
|
|||
PostsPath string `mapstructure:"posts_path" default:"./posts/"`
|
||||
}
|
||||
|
||||
func LoadConfig() (config Config, err error) {
|
||||
config = Config{}
|
||||
func LoadConfig() (config *Config, err error) {
|
||||
config = &Config{}
|
||||
if err = defaults.Set(config); err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
|
||||
viper.SetConfigName("config")
|
||||
|
|
@ -30,12 +30,12 @@ func LoadConfig() (config Config, err error) {
|
|||
viper.AddConfigPath("/58team_blog/cfgs/")
|
||||
|
||||
if err = viper.ReadInConfig(); err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = viper.Unmarshal(&config); err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return
|
||||
return config, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue