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

Add utility class to allow image names to be configured … #277

Merged
merged 1 commit into from
Jan 22, 2017

Conversation

rnorth
Copy link
Member

@rnorth rnorth commented Jan 21, 2017

... via a classpath file

Replace static string names for ambassador and vnc recorder container images with classpath lookup.

Add note to readme re overriding hardcoded image names

Refs #259, #276

@rnorth rnorth requested a review from bsideup January 21, 2017 19:23
@rnorth rnorth force-pushed the configurable-image-names branch 2 times, most recently from 7bbff66 to 17e9eb6 Compare January 22, 2017 07:58
public String vncRecordedContainerImage = "richnorth/vnc-recorder:latest";

// No public constructor - must use getInstance() method.
private TestcontainersConfiguration() {
Copy link
Member

Choose a reason for hiding this comment

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

can be replaced with NoArgsConstructor(access = lombok.AccessLevel.PRIVATE)

@@ -24,7 +25,7 @@
private final int servicePort;

public AmbassadorContainer(LinkableContainer otherContainer, String serviceName, int servicePort) {
super("richnorth/ambassador:latest");
super(TestcontainersConfiguration.getInstance().ambassadorContainerImage);
Copy link
Member

Choose a reason for hiding this comment

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

I think it's more conventional to use getters

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right - I even put the @Data annotation on for that reason! Whoops.

@rnorth
Copy link
Member Author

rnorth commented Jan 22, 2017

Squashed and pushed updates.

try (final InputStream inputStream = configOverrides.openStream()) {
properties.load(inputStream);

config.ambassadorContainerImage = properties.getProperty("ambassador.container.image", config.ambassadorContainerImage);
Copy link
Member

Choose a reason for hiding this comment

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

I just realized that if file if present, it will override both properties. What if user will override ambassador.container.image, but not vncrecorder? We probably should add a check for it

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it should be OK - this is why I provided the current value (default) as the 2nd, default, parameter to properties.getProperty(...). The intention is that if the user only provides one property, the other stays the same.

Copy link
Member

Choose a reason for hiding this comment

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

oooops, sorry, missed that!

…th file

Replace static string names for ambassador and vnc recorder container images with classpath lookup.

Add note to readme re overriding hardcoded image names

Refs #259, #276
@rnorth rnorth merged commit e5f6f90 into master Jan 22, 2017
@rnorth rnorth deleted the configurable-image-names branch January 22, 2017 09:43
@bsideup bsideup added this to the 1.1.8 milestone Mar 2, 2017
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.

2 participants