-
Notifications
You must be signed in to change notification settings - Fork 19
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
env var for config file added #135
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,7 +26,12 @@ import ( | |||||||||||||||||||||||||
func main() { | ||||||||||||||||||||||||||
ctx := context.Background() | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
c, err := config.LoadConfig("/etc/config") | ||||||||||||||||||||||||||
configPath := os.Getenv("CONFIG") | ||||||||||||||||||||||||||
if configPath == "" { | ||||||||||||||||||||||||||
configPath = "/etc/config" | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
Comment on lines
+29
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: It's a good practice to define default values as constants at the beginning of the file or package. This makes it easier to manage and change these values in the future.
Suggested change
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
c, err := config.LoadConfig(configPath) | ||||||||||||||||||||||||||
if err != nil { | ||||||||||||||||||||||||||
logger.L().Ctx(ctx).Fatal("load config error", helpers.Error(err)) | ||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||
Comment on lines
35
to
37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Error messages should be descriptive and provide context for easier debugging. Consider adding more information to the error message when the configuration file fails to load.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay |
||||||||||||||||||||||||||
|
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.
@matthyx what do you think is the proper solution here? Because we are thinking of having multiple configuration files...
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.
Exactly, the goal is to split the config between component and cluster like in node-agent.