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

Adding Check() function to test arbitrary key/values. #127

Closed
wants to merge 1 commit into from

Conversation

rossmcf
Copy link

@rossmcf rossmcf commented Jul 16, 2018

This PR adds a function called Check(), which allows users to validate keys/values from other sources. This is intended to support the development of other tools, that might check — for example — environment variables defined in docker-compose files.

This resolves #126.

@rossmcf rossmcf changed the title Adding Check() function to test arbitrary key/values. Adding Check() function to test arbitrary key/values. Jul 16, 2018
@teepark
Copy link
Collaborator

teepark commented May 24, 2019

Thanks for the diff @rossmcf, it's not a bad high-level idea.

This does more than just "check" though, it will actually populate spec from the map (the only difference from Process is the "environment" source). There might be a nasty surprise for someone who constructs their program like this:

  1. Check against a sample map to make sure the spec is in good shape
  2. Process with the same spec to actually populate it from the environment

Now if the environment was missing an optional field which had been present in the sample map, they've got a sample test value populated instead of, say, the default tag value.

If we don't expect users to put this in their production programs (maybe just in a test), it's not any different from them iterating over a map and calling os.Setenv themselves, then checking with Process as-is.

@teepark teepark closed this May 24, 2019
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.

Feature Suggestion — Check arbitrary keys/values
2 participants