fixing up templates more

This commit is contained in:
jharshman 2019-01-29 01:19:08 -08:00 committed by Steve Francia
parent 26d210e2cd
commit 17dc9f8142
3 changed files with 47 additions and 45 deletions

View file

@ -56,8 +56,8 @@ Init will not use an existing directory with contents.`,
PkgName: pkgName,
Legal: getLicense(),
Copyright: copyrightLine(),
// viper
// appname
Viper: viper.GetBool("useViper"),
AppName: path.Base(pkgName),
}
// create main.go

View file

@ -14,6 +14,8 @@ type Project struct {
Copyright string
AbsolutePath string
Legal License
Viper bool
AppName string
// v1
absPath string

View file

@ -94,9 +94,9 @@ func initConfig() {
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.SetConfigName(".{{ .appName }}")
viper.SetConfigName(".{{ .AppName }}")
}
viper.AutomaticEnv() // read in environment variables that match