8000 Baseline: Ability to set SupportLevel for categories and show marker … by DGuhr · Pull Request #12955 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.keycloak.config;

public enum ConfigSupportLevel {
DEPRECATED,
EXPERIMENTAL,
PREVIEW,
SUPPORTED
}
8000
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;
import java.util.Optional;
import java.util.Set;

public class Option<T> {

Expand All @@ -21,7 +20,7 @@ public Option(Class<T> type, String key, OptionCategory category, boolean hidden
this.category = category;
this.hidden = hidden;
this.buildTime = buildTime;
this.description = description;
this.description = getDescriptionByCategorySupportLevel(description);
this.defaultValue = defaultValue;
this.expectedValues = expectedValues;
}
Expand Down Expand Up @@ -67,4 +66,22 @@ public Option<T> withRuntimeSpecificDefault(T defaultValue) {
);
}

private String getDescriptionByCategorySupportLevel(String description) {
if(description == null || description.isBlank()) {
return description;
}

switch(this.getCategory().getSupportLevel()) {
case PREVIEW:
description = "Preview: " + description;
break;
case EXPERIMENTAL:
description = "Experimental: " + description;
break;
default:
description = description;
}

return description;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,29 @@

public enum OptionCategory {
// ordered by name asc
CLUSTERING("Cluster", 10),
STORAGE("Storage", 15),
DATABASE("Database", 20),
TRANSACTION("Transaction",30),
FEATURE("Feature", 40),
HOSTNAME("Hostname", 50),
HTTP("HTTP/TLS", 60),
HEALTH("Health", 70),
METRICS("Metrics", 80),
PROXY("Proxy", 90),
VAULT("Vault", 100),
LOGGING("Logging", 110),
GENERAL("General", 999);

private final String heading;
CLUSTERING("Cluster", 8000 10, ConfigSupportLevel.SUPPORTED),
STORAGE("Storage", 15, ConfigSupportLevel.EXPERIMENTAL),
DATABASE("Database", 20, ConfigSupportLevel.SUPPORTED),
TRANSACTION("Transaction",30, ConfigSupportLevel.SUPPORTED),
FEATURE("Feature", 40, ConfigSupportLevel.SUPPORTED),
HOSTNAME("Hostname", 50, ConfigSupportLevel.SUPPORTED),
HTTP("HTTP/TLS", 60, ConfigSupportLevel.SUPPORTED),
HEALTH("Health", 70, ConfigSupportLevel.SUPPORTED),
METRICS("Metrics", 80, ConfigSupportLevel.SUPPORTED),
PROXY("Proxy", 90, ConfigSupportLevel.SUPPORTED),
VAULT("Vault", 100, ConfigSupportLevel.SUPPORTED),
LOGGING("Logging", 110, ConfigSupportLevel.SUPPORTED),
GENERAL("General", 999, ConfigSupportLevel.SUPPORTED);

private String heading;
//Categories with a lower number are shown before groups with a higher number
private final int order;
private final ConfigSupportLevel supportLevel;

OptionCategory(String heading, int order) {
this.heading = heading; this.order = order;
OptionCategory(String heading, int order, ConfigSupportLevel supportLevel) {
this.order = order;
this.supportLevel = supportLevel;
this.heading = getHeadingBySupportLevel(heading);
}

public String getHeading() {
Expand All @@ -33,4 +35,19 @@ public int getOrder() {
return this.order;
}

public ConfigSupportLevel getSupportLevel() {
return this.supportLevel;
}

private String getHeadingBySupportLevel(String heading) {
if (this.supportLevel.equals(ConfigSupportLevel.EXPERIMENTAL)){
heading = heading + " (Experimental)";
}

if (this.supportLevel.equals(ConfigSupportLevel.PREVIEW)){
heading = heading + " (Preview)";
}

return heading;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.stream.Collectors;

import org.eclipse.microprofile.config.spi.ConfigSource;
import org.keycloak.config.ConfigSupportLevel;
import org.keycloak.config.MultiOption;
import org.keycloak.config.OptionCategory;
import org.keycloak.quarkus.runtime.cli.command.Build;
Expand Down Expand Up @@ -399,6 +400,7 @@ private static void addMappedOptionsToArgGroups(CommandSpec cSpec, List<Property

for(PropertyMapper mapper: mappersInCategory) {
String name = mapper.getCliFormat();

String description = mapper.getDescription();

if (description == null || cSpec.optionsMap().containsKey(name) || name.endsWith(OPTION_PART_SEPARATOR)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ Cluster:
Define the default stack to use for cluster communication and node discovery.
This option only takes effect if 'cache' is set to 'ispn'. Default: udp.

Storage:
Storage (Experimental):

--storage <type> Sets a storage mechanism. Possible values are: legacy, chm. Default: legacy.
--storage <type> Experimental: Sets a storage mechanism. Possible values are: legacy, chm.
Default: legacy.

Database:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ Cluster:
Define the default stack to use for cluster communication and node discovery.
This option only takes effect if 'cache' is set to 'ispn'. Default: udp.

Storage:
Storage (Experimental):

--storage <type> Sets a storage mechanism. Possible values are: legacy, chm. Default: legacy.
--storage <type> Experimental: Sets a storage mechanism. Possible values are: legacy, chm. Default:
legacy.

Database:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ Cluster:
Define the default stack to use for cluster communication and node discovery.
This option only takes effect if 'cache' is set to 'ispn'. Default: udp.

Storage:
Storage (Experimental):

--storage <type> Sets a storage mechanism. Possible values are: legacy, chm. Default: legacy.
--storage <type> Experimental: Sets a storage mechanism. Possible values are: legacy, chm.
Default: legacy.

Database:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ Cluster:
Define the default stack to use for cluster communication and node discovery.
This option only takes effect if 'cache' is set to 'ispn'. Default: udp.

Storage:
Storage (Experimental):

--storage <type> Sets a storage mechanism. Possible values are: legacy, chm. Default: legacy.
--storage <type> Experimental: Sets a storage mechanism. Possible values are: legacy, chm. Default:
legacy.

Database:

Expand Down
0