Skip to content
This repository was archived by the owner on Aug 30, 2019. It is now read-only.

Conversation

@gbbr
Copy link
Contributor

@gbbr gbbr commented Sep 18, 2018

This change ensures that configuration can only be loaded if it is valid. It adds tests for various hostname acquisition strategies to ensure hostname is always set or otherwise trace agent should fail to start.

It also renames folders test_cases to testdata, which seems more common for Go.

@gbbr gbbr added this to the next milestone Sep 18, 2018

cfg, err := config.Load(flags.ConfigPath)
if err != nil {
if !os.IsNotExist(err) {
Copy link
Contributor Author

@gbbr gbbr Sep 18, 2018

Choose a reason for hiding this comment

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

The logic was moved into config.Load because config should be validated when loaded, not separately using another call. This way, the config is loaded, validated, and overridden from environment in one call.

Copy link

@ufoot ufoot left a comment

Choose a reason for hiding this comment

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

GTM

return nil
}

// LoadEnv reads environment variable values into the config.
Copy link

Choose a reason for hiding this comment

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

Love the fact this does not need to be public any more as Load encapsulates it all.

@gbbr gbbr merged commit ea7b315 into master Sep 18, 2018
@gbbr gbbr deleted the gbbr/config-test branch September 18, 2018 12:13
@gbbr gbbr modified the milestones: next, 6.6.0 Sep 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants