Class EnvVarConfigProvider
- java.lang.Object
-
- org.apache.kafka.common.config.provider.EnvVarConfigProvider
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ConfigProvider
,Configurable
public class EnvVarConfigProvider extends Object implements ConfigProvider
An implementation ofConfigProvider
based on environment variables. Keys correspond to the names of the environment variables, paths are currently not being used. Using an allowlist patternALLOWLIST_PATTERN_CONFIG
that supports regular expressions, it is possible to limit access to specific environment variables. Default allowlist pattern is ".*".
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALLOWLIST_PATTERN_CONFIG
static String
ALLOWLIST_PATTERN_CONFIG_DOC
-
Constructor Summary
Constructors Constructor Description EnvVarConfigProvider()
EnvVarConfigProvider(Map<String,String> envVarsAsArgument)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
configure(Map<String,?> configs)
Configure this class with the given key-value pairsConfigData
get(String path)
Retrieves the data at the given path.ConfigData
get(String path, Set<String> keys)
Retrieves the data with the given keys at the given path.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.kafka.common.config.provider.ConfigProvider
subscribe, unsubscribe, unsubscribeAll
-
-
-
-
Field Detail
-
ALLOWLIST_PATTERN_CONFIG
public static final String ALLOWLIST_PATTERN_CONFIG
- See Also:
- Constant Field Values
-
ALLOWLIST_PATTERN_CONFIG_DOC
public static final String ALLOWLIST_PATTERN_CONFIG_DOC
- See Also:
- Constant Field Values
-
-
Method Detail
-
configure
public void configure(Map<String,?> configs)
Description copied from interface:Configurable
Configure this class with the given key-value pairs- Specified by:
configure
in interfaceConfigurable
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
get
public ConfigData get(String path)
Description copied from interface:ConfigProvider
Retrieves the data at the given path.- Specified by:
get
in interfaceConfigProvider
- Parameters:
path
- unused- Returns:
- returns environment variables as configuration
-
get
public ConfigData get(String path, Set<String> keys)
Description copied from interface:ConfigProvider
Retrieves the data with the given keys at the given path.- Specified by:
get
in interfaceConfigProvider
- Parameters:
path
- path, not used for environment variableskeys
- the keys whose values will be retrieved.- Returns:
- the configuration data.
-
-