-
Notifications
You must be signed in to change notification settings - Fork 6
enable to pass environment variables from outside #12
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
base: master
Are you sure you want to change the base?
enable to pass environment variables from outside #12
Conversation
ghost
left a comment
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.
Thanks for contributing, I've added a few comments/questions.
| public DockerCompose(ILogger[] logger) | ||
| private readonly IEnumerable<KeyValuePair<string, object>> environmentVariables; | ||
|
|
||
| public DockerCompose(ILogger[] logger, IEnumerable<KeyValuePair<string, object>> environmentVariables) |
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.
Why is this an IEnumerable<KeyValuePair<,>> instead of a IDictionary<,>? If it is so that the order of the env vars can be preserved then does the order matter?
| /// </summary> | ||
| /// <param name="setupOptions">Options that control how docker-compose is executed.</param> | ||
| public void InitOnce(Func<IDockerFixtureOptions> setupOptions) | ||
| public async Task InitOnceAsync(Func<IDockerFixtureOptions> setupOptions) |
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.
Whilst I have no problem with this being async, just remember that as a fixture people will be calling this from a constructor (which are inherently synchronous). So they will have to do a .GetAwaiter().GetResult(). However if you are firing off multiple async Tasks then this would still make sense.
| /// <param name="setupOptions">Options that control how docker-compose is executed.</param> | ||
| /// <param name="dockerCompose"></param> | ||
| public void InitOnce(Func<IDockerFixtureOptions> setupOptions, IDockerCompose dockerCompose) | ||
| public async Task InitOnceAsync(Func<IDockerFixtureOptions> setupOptions, IDockerCompose dockerCompose) |
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.
Same as above
| public void Init(Func<IDockerFixtureOptions> setupOptions) | ||
| public async Task InitAsync(Func<IDockerFixtureOptions> setupOptions) | ||
| { | ||
| Init(setupOptions, null); |
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.
Same as above
| } | ||
| this.loggers.Log($"---- checking docker services ({i + 1}/{this.startupTimeoutSecs}) ----"); | ||
| Thread.Sleep(this.dockerCompose.PauseMs); | ||
| await Task.Delay(1000); |
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.
Preserve the use of PauseMs
In my project, I wanted to parameterize
docker-composefile by environment variables.So that I can launch multiple instances of docker-compose and each binds to different ports and mounts on different path.
It's working fine in my project. So I will share here.