read a section of config (#255)

This commit is contained in:
Liang Mingqiang
2018-07-31 16:28:42 -04:00
committed by Robbie Zhang
parent 3e1beb3d92
commit f9c7af5ec9
2 changed files with 26 additions and 18 deletions

View File

@@ -67,6 +67,11 @@ func Execute() {
func init() {
cobra.OnInitialize(initConfig)
// read default node name from environment variable.
// it can be overwritten by cli flags if specified.
if os.Getenv("DEFAULT_NODE_NAME") != "" {
nodeName = os.Getenv("DEFAULT_NODE_NAME")
}
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.