public static ConfigSource[] getConfigSources() { return getConfigProvider().getConfig().getConfigSources(); }
/** * The entry point to the builder-based optionally typed configuration resolution mechanism. * * String is the default type for configuration entries and is not considered a 'type' by this resolver. Therefore * an UntypedResolver is returned by this method. To convert the configuration value to another type, call * {@link UntypedResolver#as(Class)}. * * @param name The property key to resolve * @return A builder for configuration resolution. */ public static UntypedResolver<String> resolve(String name) { return getConfigProvider().getConfig().resolve(name); }
/** * Add a {@link ConfigFilter} to the ConfigResolver. This will only affect the current WebApp (or more precisely the * current ClassLoader and it's children). * * @param configFilter */ public static void addConfigFilter(ConfigFilter configFilter) { getConfigProvider().getConfig().addConfigFilter(configFilter); }
configSource.setValues(newVals); hostCfg = cfg.resolve(HOST_KEY); port1Cfg = cfg.resolve(PORT1_KEY).as(Integer.class); port2Cfg = cfg.resolve(PORT2_KEY).as(Integer.class); assertEquals(Integer.valueOf(1), port2Cfg.getValue()); ConfigSnapshot configSnapshot = cfg.snapshotFor(hostCfg, port1Cfg, port2Cfg); assertNotNull(configSnapshot);
/** * Filter the configured value. * This can e.g. be used for decryption. * @return the filtered value */ public static String filterConfigValue(String key, String value) { return getConfigProvider().getConfig().filterConfigValue(key, value, false); }
/** * This method can be used for programmatically adding {@link ConfigSource}s. * It is not needed for normal 'usage' by end users, but only for Extension Developers! * * @param configSourcesToAdd the ConfigSources to add */ public static synchronized void addConfigSources(List<ConfigSource> configSourcesToAdd) { getConfigProvider().getConfig().addConfigSources(configSourcesToAdd); }
/** * @return the {@link ConfigFilter}s for the current application. */ public static List<ConfigFilter> getConfigFilters() { return getConfigProvider().getConfig().getConfigFilters(); }
/** * Filter the configured value. * This can e.g. be used for decryption. * @return the filtered value */ public static String filterConfigValue(String key, String value) { return getConfigProvider().getConfig().filterConfigValue(key, value, false); }
/** * This method can be used for programmatically adding {@link ConfigSource}s. * It is not needed for normal 'usage' by end users, but only for Extension Developers! * * @param configSourcesToAdd the ConfigSources to add */ public static synchronized void addConfigSources(List<ConfigSource> configSourcesToAdd) { getConfigProvider().getConfig().addConfigSources(configSourcesToAdd); }
/** * @return the {@link ConfigFilter}s for the current application. */ public static List<ConfigFilter> getConfigFilters() { return getConfigProvider().getConfig().getConfigFilters(); }
/** * The entry point to the builder-based optionally typed configuration resolution mechanism. * * String is the default type for configuration entries and is not considered a 'type' by this resolver. Therefore * an UntypedResolver is returned by this method. To convert the configuration value to another type, call * {@link UntypedResolver#as(Class)}. * * @param name The property key to resolve * @return A builder for configuration resolution. */ public static UntypedResolver<String> resolve(String name) { return getConfigProvider().getConfig().resolve(name); }
public static ConfigSource[] getConfigSources() { return getConfigProvider().getConfig().getConfigSources(); }
/** * Filter the configured value for logging. * This can e.g. be used for displaying ***** instead of a real password. * @return the filtered value */ public static String filterConfigValueForLog(String key, String value) { return getConfigProvider().getConfig().filterConfigValue(key, value, true); }
/** * Add a {@link ConfigFilter} to the ConfigResolver. This will only affect the current WebApp (or more precisely the * current ClassLoader and it's children). * * @param configFilter */ public static void addConfigFilter(ConfigFilter configFilter) { getConfigProvider().getConfig().addConfigFilter(configFilter); }
/** * Resolves the value configured for the given key. * * @param key the property key * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(true) .withCurrentProjectStage(false) .getValue(); }
/** * Returns a Map of all properties from all scannable config sources. The values of the properties reflect the * values that would be obtained by a call to {@link #getPropertyValue(java.lang.String)}, that is, the value of the * property from the ConfigSource with the highest ordinal. * * @see ConfigSource#isScannable() */ public static Map<String, String> getAllProperties() { ConfigSource[] configSources = getConfigProvider().getConfig().getConfigSources(); Map<String, String> result = new HashMap<String, String>(); for (int i = configSources.length; i > 0; i--) { ConfigSource configSource = configSources[i - 1]; if (configSource.isScannable()) { result.putAll(configSource.getProperties()); } } return Collections.unmodifiableMap(result); }
/** * Filter the configured value for logging. * This can e.g. be used for displaying ***** instead of a real password. * @return the filtered value */ public static String filterConfigValueForLog(String key, String value) { return getConfigProvider().getConfig().filterConfigValue(key, value, true); }
/** * Resolves the value configured for the given key. * * @param key the property key * @param evaluateVariables whether to evaluate any '${variablename}' variable expressions * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key, boolean evaluateVariables) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(evaluateVariables) .withCurrentProjectStage(false) .getValue(); }
public static ConfigurableTestConfigSource instance() { return (ConfigurableTestConfigSource) Arrays.stream(ConfigResolver.getConfig().getConfigSources()) .filter(cs -> cs instanceof ConfigurableTestConfigSource) .findFirst() .get(); }
/** * Resolves the value configured for the given key. * * @param key the property key * * @return the configured property value from the {@link ConfigSource} with the highest ordinal or null if there is * no configured value for it */ public static String getPropertyValue(String key) { return getConfigProvider().getConfig().resolve(key) .evaluateVariables(true) .withCurrentProjectStage(false) .getValue(); }