Skip to content

Commit

Permalink
Vault: add a fluent API for configuring Vault's logging level (#2231)
Browse files Browse the repository at this point in the history
  • Loading branch information
Or Noyman committed Oct 30, 2020
1 parent 0ac9689 commit e64db24
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

import static com.github.dockerjava.api.model.Capability.IPC_LOCK;

Expand Down Expand Up @@ -106,6 +107,17 @@ public SELF withVaultPort(int port) {
return self();
}

/**
* Sets the logging level for the Vault server in the container.
* Logs can be consumed through {@link #withLogConsumer(Consumer)}.
*
* @param level the logging level to set for Vault.
* @return this
*/
public SELF withLogLevel(VaultLogLevel level) {
return withEnv("VAULT_LOG_LEVEL", level.config);
}

/**
* Pre-loads secrets into Vault container. User may specify one or more secrets and all will be added to each path
* that is specified. Thus this can be called more than once for multiple paths to be added to Vault.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.testcontainers.vault;

/**
* Vault preset of logging levels.
*/
public enum VaultLogLevel {
Trace("trace"), Debug("debug"), Info("info"), Warn("warn"), Error("err");

public final String config;

VaultLogLevel(String config) {
this.config = config;
}
}

0 comments on commit e64db24

Please sign in to comment.