Skip to content
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

apply env to array elements #350

Merged

Conversation

jonseymour
Copy link
Contributor

This fixes #348.

In particular:

KAPACITOR_INFLUXDB_0_URLS_0=http://localhost:9000 kapacitord config

should now produce a config which does the expected thing.

@nathanielc
Copy link
Contributor

@jonseymour Thanks for the PR, I know I don't have any tests around config parsing, but could you add a test that demonstrates the new behavior? Don't worry about testing everything else just the changes. We will get to the other tests in time.

@jonseymour
Copy link
Contributor Author

Ok, I'll add tests. I'll have to abstract the call to os.GetEnv() to allow tests to mock this call, as required.

@jonseymour jonseymour force-pushed the jss-348-apply-env-to-array-elements branch from 8f2928b to 0e18d04 Compare March 17, 2016 22:49
@jonseymour
Copy link
Contributor Author

@nathanielc I've extended a test and done a more complete reorganisation to simplify the structure of the applyEnvOverrides function.

@jonseymour
Copy link
Contributor Author

Actually, I missed an additional simplifcation that is now possible. I'll re-roll.

…lements

The refactor splits the handling of structs into a separate function and adds
a possibly empty fieldDesc parameter to applyEnvOverrides to allow applyEnvOverrides
to handle simple values as well as structs.

Signed-off-by: Jon Seymour <[email protected]>
2nd parent of merge, merges cleanly with v0.10 branch.
@jonseymour jonseymour force-pushed the jss-348-apply-env-to-array-elements branch from 0e18d04 to c92aa78 Compare March 17, 2016 23:02
@nathanielc
Copy link
Contributor

@jonseymour Just to make sure, you made that last simplification correct? Also can you add a changelog entry? Otherwise this looks good to go. Thanks!

@jonseymour
Copy link
Contributor Author

Yes, simplifications complete. Changelog now updated.

@offlinehacker
Copy link

Nice, this should remove sed magic from my Docker image, thanks!

nathanielc pushed a commit that referenced this pull request Mar 21, 2016
@nathanielc nathanielc merged commit e1485a2 into influxdata:master Mar 21, 2016
@jonseymour jonseymour deleted the jss-348-apply-env-to-array-elements branch March 24, 2016 05:53
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.

applyEnvOverrides fails to override array elements
3 participants