config tips and config distinctions & help reminder#100
config tips and config distinctions & help reminder#100kelevis wants to merge 3 commits intoqingwave:masterfrom
Conversation
|
config tips and config distinctions. |
qingwave
left a comment
There was a problem hiding this comment.
Thanks for your PR, seems this PR want to support env mode(test, dev, prod), there are some questions here:
app.yamlis the default config for the project, if users need custom config, just copy theapp.yamland modify it.- if we need different configs for different env, but
dev_config.yamlandprod_config.yamlare same at this time point.
I suggest we donot need to change the app.yaml, just add some details(how to config in different configs) in the ReadMe.
If you have some better ideas, feel free to comments.
thanks you again.
| logger.Fatalf("Failed to parse config: %v", err) | ||
| } | ||
|
|
||
| if *appConfig != defaultConfigPath { |
There was a problem hiding this comment.
It's better print config path rather than a info
if appConfig != nil {
logger.Info(App config from "%s", *appConfig)
}
| return version | ||
| } | ||
|
|
||
| func ConfigPathPrint() { |
There was a problem hiding this comment.
We donot need to change this file, just print info in main.go
| @@ -0,0 +1,45 @@ | |||
| server: | |||
| env: "debug" | |||
| address: "127.0.0.1" | |||
There was a problem hiding this comment.
If this a production config, we need modify some params.
env: release
address: 0.0.0.0
| var ( | ||
| printVersion = flag.Bool("v", false, "print version") | ||
| appConfig = flag.String("config", "config/app.yaml", "application config path") | ||
| defaultConfigPath = "config/dev_config.yaml" |
There was a problem hiding this comment.
defaultConfigPath -> defaultConfig
No description provided.