Skip to content

Commit

Permalink
Grab circle envvars by default and remove config option
Browse files Browse the repository at this point in the history
  • Loading branch information
CRogers committed Aug 8, 2019
1 parent a56e532 commit 2a2e3c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,22 @@
package com.palantir.docker.compose.reporting;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.collect.ImmutableList;
import com.palantir.docker.compose.CustomImmutablesStyle;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.immutables.value.Value;

@Value.Immutable
@CustomImmutablesStyle
@JsonDeserialize(as = ImmutableReportingConfig.class)
public interface ReportingConfig {
String url();
List<String> environmentVariableWhitelist();

@Value.Auxiliary
@Value.Derived
default PatternCollection envVarWhitelistPatterns() {
return new PatternCollection(environmentVariableWhitelist().stream()
.map(Pattern::compile)
.collect(Collectors.toList()));
return new PatternCollection(ImmutableList.of(
Pattern.compile("^CIRCLE")));
}

class Builder extends ImmutableReportingConfig.Builder {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ public void can_derserialize_config_found_one_dir_up() throws IOException {
File config = temporaryFolder.newFile(".docker-compose-rule.yml");
Files.write(config.toPath(), ImmutableList.of(
"reporting:",
" url: http://example.com/",
" environmentVariableWhitelist: ['^foobar$']"
" url: http://example.com/"
), StandardCharsets.UTF_8);

File startDir = temporaryFolder.newFolder("start-dir");

assertThat(DockerComposeRuleConfig.findAutomaticallyFrom(startDir)).hasValue(DockerComposeRuleConfig.builder()
.reporting(ReportingConfig.builder()
.url("http://example.com/")
.addEnvironmentVariableWhitelist("^foobar$")
.build())
.build());
}
Expand Down

0 comments on commit 2a2e3c2

Please sign in to comment.