Skip to content

add read config from file #3

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

Merged
merged 1 commit into from
May 22, 2017
Merged

add read config from file #3

merged 1 commit into from
May 22, 2017

Conversation

mnaboka
Copy link
Contributor

@mnaboka mnaboka commented May 22, 2017

use viper to read a config file and populate the config structure

cmd/root.go Outdated

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
logrus.Infof("Using config file: %s", viper.ConfigFileUsed())
DCOSConfig.Role = viper.GetString("role")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we prefer to change the condition here to err != nil and then fail and early in that clause, and then set the DSOSConfig properties after the if conditional?

@mnaboka mnaboka force-pushed the mnaboka/add-config branch from c800461 to b2eeac4 Compare May 22, 2017 17:46
@mnaboka mnaboka merged commit 42dc43b into master May 22, 2017
@mnaboka mnaboka deleted the mnaboka/add-config branch May 22, 2017 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants