mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-24 00:51:50 +00:00
Better organization of loading defaults
This commit is contained in:
parent
bdb187e482
commit
fd5cf9ac8d
1 changed files with 15 additions and 11 deletions
|
@ -119,17 +119,7 @@ func init() {
|
||||||
You need to open cmd.exe and run it from there.`
|
You need to open cmd.exe and run it from there.`
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitializeConfig initializes a config file with sensible default configuration flags.
|
func LoadDefaultSettings() {
|
||||||
func InitializeConfig() {
|
|
||||||
viper.SetConfigFile(CfgFile)
|
|
||||||
viper.AddConfigPath(Source)
|
|
||||||
err := viper.ReadInConfig()
|
|
||||||
if err != nil {
|
|
||||||
jww.ERROR.Println("Unable to locate Config file. Perhaps you need to create a new site. Run `hugo help new` for details")
|
|
||||||
}
|
|
||||||
|
|
||||||
viper.RegisterAlias("indexes", "taxonomies")
|
|
||||||
|
|
||||||
viper.SetDefault("Watch", false)
|
viper.SetDefault("Watch", false)
|
||||||
viper.SetDefault("MetaDataFormat", "toml")
|
viper.SetDefault("MetaDataFormat", "toml")
|
||||||
viper.SetDefault("DisableRSS", false)
|
viper.SetDefault("DisableRSS", false)
|
||||||
|
@ -164,6 +154,20 @@ func InitializeConfig() {
|
||||||
viper.SetDefault("Blackfriday", helpers.NewBlackfriday())
|
viper.SetDefault("Blackfriday", helpers.NewBlackfriday())
|
||||||
viper.SetDefault("RSSUri", "index.xml")
|
viper.SetDefault("RSSUri", "index.xml")
|
||||||
viper.SetDefault("SectionPagesMenu", "")
|
viper.SetDefault("SectionPagesMenu", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitializeConfig initializes a config file with sensible default configuration flags.
|
||||||
|
func InitializeConfig() {
|
||||||
|
viper.SetConfigFile(CfgFile)
|
||||||
|
viper.AddConfigPath(Source)
|
||||||
|
err := viper.ReadInConfig()
|
||||||
|
if err != nil {
|
||||||
|
jww.ERROR.Println("Unable to locate Config file. Perhaps you need to create a new site. Run `hugo help new` for details")
|
||||||
|
}
|
||||||
|
|
||||||
|
viper.RegisterAlias("indexes", "taxonomies")
|
||||||
|
|
||||||
|
LoadDefaultSettings()
|
||||||
|
|
||||||
if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
|
if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
|
||||||
viper.Set("BuildDrafts", Draft)
|
viper.Set("BuildDrafts", Draft)
|
||||||
|
|
Loading…
Reference in a new issue