fixing up templates more
This commit is contained in:
parent
26d210e2cd
commit
17dc9f8142
@ -56,8 +56,8 @@ Init will not use an existing directory with contents.`,
|
|||||||
PkgName: pkgName,
|
PkgName: pkgName,
|
||||||
Legal: getLicense(),
|
Legal: getLicense(),
|
||||||
Copyright: copyrightLine(),
|
Copyright: copyrightLine(),
|
||||||
// viper
|
Viper: viper.GetBool("useViper"),
|
||||||
// appname
|
AppName: path.Base(pkgName),
|
||||||
}
|
}
|
||||||
|
|
||||||
// create main.go
|
// create main.go
|
||||||
|
@ -14,6 +14,8 @@ type Project struct {
|
|||||||
Copyright string
|
Copyright string
|
||||||
AbsolutePath string
|
AbsolutePath string
|
||||||
Legal License
|
Legal License
|
||||||
|
Viper bool
|
||||||
|
AppName string
|
||||||
|
|
||||||
// v1
|
// v1
|
||||||
absPath string
|
absPath string
|
||||||
|
@ -94,9 +94,9 @@ func initConfig() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search config in home directory with name ".{{ .appName }}" (without extension).
|
// Search config in home directory with name ".{{ .AppName }}" (without extension).
|
||||||
viper.AddConfigPath(home)
|
viper.AddConfigPath(home)
|
||||||
viper.SetConfigName(".{{ .appName }}")
|
viper.SetConfigName(".{{ .AppName }}")
|
||||||
}
|
}
|
||||||
|
|
||||||
viper.AutomaticEnv() // read in environment variables that match
|
viper.AutomaticEnv() // read in environment variables that match
|
||||||
|
Loading…
Reference in New Issue
Block a user