-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config tips and config distinctions & help reminder #100
base: master
Are you sure you want to change the base?
Conversation
config tips and config distinctions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR, seems this PR want to support env mode(test, dev, prod), there are some questions here:
app.yaml
is the default config for the project, if users need custom config, just copy theapp.yaml
and modify it.- if we need different configs for different env, but
dev_config.yaml
andprod_config.yaml
are 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.
@@ -45,6 +46,10 @@ func main() { | |||
logger.Fatalf("Failed to parse config: %v", err) | |||
} | |||
|
|||
if *appConfig != defaultConfigPath { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better print config path rather than a info
if appConfig != nil {
logger.Info(App config from "%s", *appConfig)
}
@@ -48,3 +48,7 @@ func Print() { | |||
func Get() *Version { | |||
return version | |||
} | |||
|
|||
func ConfigPathPrint() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this a production config, we need modify some params.
env: release
address: 0.0.0.0
@@ -12,8 +12,9 @@ import ( | |||
) | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultConfigPath -> defaultConfig
No description provided.