-
Notifications
You must be signed in to change notification settings - Fork 102
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
Allow for multiple env-files #616
Allow for multiple env-files #616
Conversation
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.
The implementation looks good! Many thanks! I think we just need one additional test to be confident about the implementation
assert client_config.docker_compose_cmd[index + 1] == env_file | ||
|
||
|
||
def test_compose_env_files_and_env_file(): |
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.
The tests are good, keep them :) I'd also like a test which actually runs the docker compose command and checks that the env files are loaded correctly. For example with docker.compose.config()
. If for example, you made a typo in --env-file
in the unit test and the main implementation, your tests can't currently detect it. Running the true command in test would detect such an error.
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.
Added some more tests now that actually run the command by using the equivalent of docker compose run
. Some temporary env-files are made, and the containers are then inspected to verify that the actual environment variables set in the container are as expected. Pretty verbose, and I am sure it can be done simpler, but let me know if this is what you wanted :)
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.
Rather than running the containers, using https://gabrieldemarmiesse.github.io/python-on-whales/sub-commands/compose/#python_on_whales.components.compose.cli_wrapper.ComposeCLI.config would have made the test simpler no? just switch docker.compose.run
for docker.compose.config()
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.
Aha, yeah that is a lot simpler. Updated now :)
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.
Sorry, I meant to request changes
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.
Looks good! Thanks!
69b2ac3
into
gabrieldemarmiesse:master
Sorry for the mess with multiple PRs, not used to making PR's from forks :)
Closes #553
Keeps backwards compatibility with the compose_env_file parameter, but advises the user to use the new compose_env_files parameter instead. If both parameters are given, the compose_env_files will take presedence.
Added tests to verify behavior