use of org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper in project keycloak by keycloak.
the class Help method isVisible.
private boolean isVisible(OptionSpec option) {
if (allOptions) {
return true;
}
String optionName = option.longestName();
boolean isFeatureOption = optionName.startsWith("--feature");
String canonicalOptionName = NS_KEYCLOAK_PREFIX.concat(optionName.replace("--", ""));
String propertyName = getMappedPropertyName(canonicalOptionName);
PropertyMapper mapper = getMapper(propertyName);
if (mapper == null && !isFeatureOption) {
// only filter mapped and non-feature options
return true;
}
String commandName = commandSpec().name();
boolean isBuildTimeProperty = isFeatureOption || mapper.isBuildTime();
if (Build.NAME.equals(commandName)) {
// by default, build command only shows build time props
return isBuildTimeProperty;
}
if (StartDev.NAME.equals(commandName)) {
// by default, start-dev command only shows runtime props
return !isBuildTimeProperty;
}
return true;
}
use of org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper in project keycloak by keycloak.
the class Picocli method hasConfigChanges.
private static boolean hasConfigChanges() {
Optional<String> currentProfile = Optional.ofNullable(Environment.getProfile());
Optional<String> persistedProfile = getBuildTimeProperty("kc.profile");
if (!persistedProfile.orElse("").equals(currentProfile.orElse(""))) {
return true;
}
for (String propertyName : getConfig().getPropertyNames()) {
// only check keycloak build-time properties
if (!isBuildTimeProperty(propertyName)) {
continue;
}
ConfigValue configValue = getConfig().getConfigValue(propertyName);
if (configValue == null || configValue.getConfigSourceName() == null) {
continue;
}
// try to resolve any property set using profiles
if (propertyName.startsWith("%")) {
propertyName = propertyName.substring(propertyName.indexOf('.') + 1);
}
String persistedValue = getBuildTimeProperty(propertyName).orElse("");
String runtimeValue = getRuntimeProperty(propertyName).orElse(null);
if (runtimeValue == null && isNotBlank(persistedValue)) {
PropertyMapper mapper = PropertyMappers.getMapper(propertyName);
if (mapper != null && persistedValue.equals(mapper.getDefaultValue())) {
// same as default
continue;
}
// probably because it was unset
return true;
}
// changes to a single property is enough to indicate changes to configuration
if (!persistedValue.equals(runtimeValue)) {
return true;
}
}
return false;
}
Aggregations