Package org.projectnessie.client.config
Class NessieClientConfigSources
- java.lang.Object
-
- org.projectnessie.client.config.NessieClientConfigSources
-
public final class NessieClientConfigSources extends java.lang.ObjectProvides functionality to retrieve configuration values from various sources, like Java properties, maps and environment variables.Note that the current implementation does not need any additional libraries. If there is a need for advanced features like config encryption or expressions, the implementation might start using SmallRye-Config.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NessieClientConfigSourcedefaultConfigSources()Creates a configuration value retriever using reasonable default config sources.static NessieClientConfigSourcedotEnvFileConfigSource()Uses values from the~/.envfile.static NessieClientConfigSourceemptyConfigSource()static NessieClientConfigSourceenvironmentConfigSource(java.util.Map<java.lang.String,java.lang.String> environment)Uses values from the given map, where keys in the file follow theenvironment name mapping.static NessieClientConfigSourceenvironmentFileConfigSource(java.nio.file.Path envFile)Uses values from the given file, where keys in the file follow theenvironment name mapping.static NessieClientConfigSourcemapConfigSource(java.util.Map<java.lang.String,java.lang.String> properties)Uses values from the givenMap.static NessieClientConfigSourcenessieClientConfigFileConfigSource()Uses values from the~/.config/nessie/nessie-client.propertiesfile.static NessieClientConfigSourcepropertiesConfigSource(java.util.Properties properties)Uses values from the givenProperties.static NessieClientConfigSourcepropertiesFileConfigSource(java.nio.file.Path propertiesFile)Uses values from the given properties file.static java.lang.StringpropertyNameToEnvironmentName(java.lang.String propertyName)Converts a given property name to the "environment variable name syntax", using upper-case characters and converting.("dot") and-("minus") to_("underscore").static NessieClientConfigSourcesystemEnvironmentConfigSource()Uses values from the system environment, keys follow theenvironment name mapping.static NessieClientConfigSourcesystemPropertiesConfigSource()Uses values from the Java system properties of the process.
-
-
-
Method Detail
-
dotEnvFileConfigSource
public static NessieClientConfigSource dotEnvFileConfigSource()
Uses values from the~/.envfile.Similar to the behavior of smallrye-config, the
~/.envfile must be in the Java properties file format.
-
nessieClientConfigFileConfigSource
public static NessieClientConfigSource nessieClientConfigFileConfigSource()
Uses values from the~/.config/nessie/nessie-client.propertiesfile.
-
systemEnvironmentConfigSource
public static NessieClientConfigSource systemEnvironmentConfigSource()
Uses values from the system environment, keys follow theenvironment name mapping.
-
systemPropertiesConfigSource
public static NessieClientConfigSource systemPropertiesConfigSource()
Uses values from the Java system properties of the process.- See Also:
propertiesConfigSource(Properties)
-
environmentFileConfigSource
public static NessieClientConfigSource environmentFileConfigSource(java.nio.file.Path envFile)
Uses values from the given file, where keys in the file follow theenvironment name mapping.Similar to the behavior of smallrye-config, the
.envfile must be in the Java properties file format.
-
environmentConfigSource
public static NessieClientConfigSource environmentConfigSource(java.util.Map<java.lang.String,java.lang.String> environment)
Uses values from the given map, where keys in the file follow theenvironment name mapping.
-
propertiesFileConfigSource
public static NessieClientConfigSource propertiesFileConfigSource(java.nio.file.Path propertiesFile)
Uses values from the given properties file.
-
propertiesConfigSource
public static NessieClientConfigSource propertiesConfigSource(java.util.Properties properties)
Uses values from the givenProperties.
-
mapConfigSource
public static NessieClientConfigSource mapConfigSource(java.util.Map<java.lang.String,java.lang.String> properties)
Uses values from the givenMap.- See Also:
propertiesConfigSource(Properties)
-
propertyNameToEnvironmentName
public static java.lang.String propertyNameToEnvironmentName(java.lang.String propertyName)
Converts a given property name to the "environment variable name syntax", using upper-case characters and converting.("dot") and-("minus") to_("underscore").
-
defaultConfigSources
public static NessieClientConfigSource defaultConfigSources()
Creates a configuration value retriever using reasonable default config sources.Config values are retrieved from the following sources:
- Java system properties, see
systemPropertiesConfigSource() - Process environment, see
systemEnvironmentConfigSource() ~/.config/nessie/nessie-client-propertiesfile, seenessieClientConfigFileConfigSource()~/.envfile, seedotEnvFileConfigSource()
- Java system properties, see
-
emptyConfigSource
public static NessieClientConfigSource emptyConfigSource()
-
-