viper.SetConfigName("config") // name of config file (without extension) viper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the name viper.AddConfigPath("/etc/appname/") // path to look for the config file in viper.AddConfigPath("$HOME/.app...
DATA = example--0.1.sql# script files to install# REGRESS = example_test # our test script file (without extension)MODULES = example# our c module file to build# postgres build stuffPG_CONFIG = pg_config PGXS :=$(shell$(PG_CONFIG)--pgxs) 安装 makeinstall 效果 make install /usr/bin...
"license", "l", "", "Name of license for the project (can provide `licensetext` in config)") RootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") // Cobra同样支持局部标签(local
=""{viper.SetConfigFile(configVar)}else{viper.SetConfigName("config")//name of config file (without extension)viper.AddConfigPath("/etc/myapp")viper.AddConfigPath("$HOME/.myapp/")viper.AddConfigPath(".")}err=viper.ReadInConfig()iferr!=nil{panic(fmt.Errorf("error reading config: %s",...
Makefile EXTENSION = example DATA = example--0.1.sql # script files to install # REGRESS = example_test # our test script file (without extension) MODULES = example # our c module file to build # postgres build stuff PG_CONFIG = pg_config ...
file insteadoftheoneinthemoduleroot directory. A file named "go.mod" must still be presentinordertodetermine themoduleroot directory, but itisnotaccessed.When-modfileisspecified, an alternate go.sum fileisalso used: its pathisderivedfromthe-modfile flagbytrimming the ".mod" extensionandappending...
viper.SetConfigName("config") // name of config file (without extension)viper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the nameviper.AddConfigPath("/etc/appname/") // path to look for the config file inviper.AddConfigPath("$HOME/.appname"...
viper.SetConfigName("config") //name of config file (without extension) viper.AddConfigPath("/etc/myapp") viper.AddConfigPath("$HOME/.myapp/") viper.AddConfigPath(".") } err = viper.ReadInConfig() if err != nil { panic(fmt.Errorf("error reading config: %s", err)) ...
viper.SetConfigName("config")// name of config file (without extension)viper.SetConfigType("yaml")// REQUIRED if the config file does not have the extension in the nameviper.AddConfigPath("/etc/appname/")// path to look for the config file inviper.AddConfigPath("$HOME/.appname")//...
ConfigFile(cfgFile) // } // viper.SetConfigName(".demo") // name of config file (without extension) // viper.AddConfigPath("$HOME") // adding home directory as first search path // viper.AutomaticEnv() // read in environment variables that match // // If a config file is found...