Adds config metadata docs back to config properties.

This commit is contained in:
Spencer Gibb
2018-04-12 12:31:19 -04:00
parent 17a2cadabb
commit cc75e9a839
7 changed files with 67 additions and 3 deletions

View File

@@ -23,9 +23,16 @@ import org.springframework.cloud.config.server.support.AbstractScmAccessorProper
public class JGitEnvironmentProperties extends AbstractScmAccessorProperties {
private static final String DEFAULT_LABEL = "master";
/** Flag to indicate that the repository should be cloned on startup (not on demand). Generally leads to slower startup but faster first query. */
private boolean cloneOnStart = false;
/** Flag to indicate that the repository should force pull. If true discard any local changes and take from remote repository. */
private boolean forcePull;
/** Timeout (in seconds) for obtaining HTTP or SSH connection (if applicable), defaults to 5 seconds. */
private int timeout = 5;
/** Flag to indicate that the branch should be deleted locally if it's origin tracked branch was removed. */
private boolean deleteUntrackedBranches = false;
/**

View File

@@ -27,6 +27,7 @@ public class JdbcEnvironmentProperties implements EnvironmentRepositoryPropertie
private static final String DEFAULT_SQL = "SELECT KEY, VALUE from PROPERTIES where APPLICATION=? and PROFILE=? and LABEL=?";
private int order = Ordered.LOWEST_PRECEDENCE - 10;
/** SQL used to query database for keys and values */
private String sql = DEFAULT_SQL;
public int getOrder() {

View File

@@ -25,6 +25,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
*/
@ConfigurationProperties("spring.cloud.config.server.git")
public class MultipleJGitEnvironmentProperties extends JGitEnvironmentProperties {
/**
* Map of repository identifier to location and other properties.
*/
private Map<String, PatternMatchingJGitEnvironmentProperties> repos = new LinkedHashMap<>();
public Map<String, PatternMatchingJGitEnvironmentProperties> getRepos() {
@@ -36,7 +39,13 @@ public class MultipleJGitEnvironmentProperties extends JGitEnvironmentProperties
}
public static class PatternMatchingJGitEnvironmentProperties extends JGitEnvironmentProperties {
/**
* Pattern to match on application name and profiles.
*/
private String[] pattern = new String[0];
/**
* Name of repository (same as map key by default).
*/
private String name;
public String[] getPattern() {

View File

@@ -24,10 +24,23 @@ import org.springframework.core.Ordered;
*/
@ConfigurationProperties("spring.cloud.config.server.native")
public class NativeEnvironmentProperties implements EnvironmentRepositoryProperties {
/**
* Flag to determine how to handle exceptions during decryption (default false).
*/
private Boolean failOnError = false;
/**
* Flag to determine whether label locations should be added.
*/
private Boolean addLabelLocations = true;
private String defaultLabel = "master";
/**
* Locations to search for configuration files. Defaults to the same as a Spring Boot
* app so [classpath:/,classpath:/config/,file:./,file:./config/].
*/
private String[] searchLocations = new String[0];
/**
* Version string to be reported for native repository
*/
private String version;
private int order = Ordered.LOWEST_PRECEDENCE;

View File

@@ -24,11 +24,17 @@ import org.springframework.core.Ordered;
*/
@ConfigurationProperties("spring.cloud.config.server.vault")
public class VaultEnvironmentProperties implements EnvironmentRepositoryProperties {
/** Vault host. Defaults to 127.0.0.1. */
private String host = "127.0.0.1";
/** Vault port. Defaults to 8200. */
private Integer port = 8200;
/** Vault scheme. Defaults to http. */
private String scheme = "http";
/** Vault backend. Defaults to secret. */
private String backend = "secret";
/** The key in vault shared by all applications. Defaults to application. Set to empty to disable. */
private String defaultKey = "application";
/** Vault profile separator. Defaults to comma. */
private String profileSeparator = ",";
private int order = Ordered.LOWEST_PRECEDENCE;

View File

@@ -20,14 +20,16 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.JsonNode;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.cloud.config.environment.Environment;
@@ -61,7 +63,8 @@ public class VaultEnvironmentRepository implements EnvironmentRepository, Ordere
private String host;
/** Vault port. Defaults to 8200. */
@Range(min = 1, max = 65535)
@Min(1)
@Max(65535)
private int port;
/** Vault scheme. Defaults to http. */

View File

@@ -25,14 +25,39 @@ import org.springframework.core.Ordered;
public class AbstractScmAccessorProperties implements EnvironmentRepositoryProperties {
static final String[] DEFAULT_LOCATIONS = new String[] { "/" };
/**
* URI of remote repository.
*/
private String uri;
/**
* Base directory for local working copy of repository.
*/
private File basedir;
/**
* Search paths to use within local working copy. By default searches only the root.
*/
private String[] searchPaths = DEFAULT_LOCATIONS.clone();;
/**
* Username for authentication with remote repository.
*/
private String username;
/**
* Password for authentication with remote repository.
*/
private String password;
/**
* Passphrase for unlocking your ssh private key.
*/
private String passphrase;
/**
* Reject incoming SSH host keys from remote servers not in the known host list.
*/
private boolean strictHostKeyChecking = true;
/** The order of the environment repository. */
private int order = Ordered.LOWEST_PRECEDENCE;
/** The default label to be used with the remore repository */
private String defaultLabel;
public String getUri() {