[KEYCLOAK-19309] - Initial support for auto-complete
This commit is contained in:
parent
8f3940032e
commit
cdfe29d1e3
13 changed files with 235 additions and 31 deletions
|
@ -35,7 +35,7 @@ do
|
|||
case "$1" in
|
||||
--debug)
|
||||
DEBUG_MODE=true
|
||||
if [ -n "$2" ] && [ "$2" = `echo "$2" | sed 's/-//'` ]; then
|
||||
if [ -n "$2" ] && [[ "$2" =~ ^[0-9]+$ ]]; then
|
||||
DEBUG_PORT=$2
|
||||
shift
|
||||
fi
|
||||
|
@ -83,6 +83,10 @@ JAVA_RUN_OPTS="$JAVA_OPTS $SERVER_OPTS -cp $CLASSPATH_OPTS io.quarkus.bootstrap.
|
|||
|
||||
if [[ $CONFIG_ARGS = *"--auto-build"* ]]; then
|
||||
java -Dkc.config.rebuild-and-exit=true $JAVA_RUN_OPTS
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE != 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
fi
|
||||
|
||||
exec java ${JAVA_RUN_OPTS}
|
|
@ -20,6 +20,7 @@ package org.keycloak.cli;
|
|||
import static org.keycloak.configuration.Configuration.getConfig;
|
||||
import static org.keycloak.configuration.PropertyMappers.isBuildTimeProperty;
|
||||
import static org.keycloak.util.Environment.isDevMode;
|
||||
import static picocli.CommandLine.Model.UsageMessageSpec.SECTION_KEY_COMMAND_LIST;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -57,6 +58,7 @@ public final class Picocli {
|
|||
private static final Logger logger = Logger.getLogger(Picocli.class);
|
||||
private static final String ARG_SEPARATOR = ";;";
|
||||
private static final String ARG_PREFIX = "--";
|
||||
public static final char ARG_KEY_VALUE_SEPARATOR = '=';
|
||||
|
||||
private Picocli() {
|
||||
}
|
||||
|
@ -232,11 +234,12 @@ public final class Picocli {
|
|||
|
||||
for (Profile.Feature feature : Profile.Feature.values()) {
|
||||
addOption(spec.subcommands().get(Build.NAME).getCommandSpec(), "--features-" + feature.name().toLowerCase(),
|
||||
"Enables the " + feature.name() + " feature. Set enabled to enable the feature or disabled otherwise.");
|
||||
"Enables the " + feature.name() + " feature. Set enabled to enable the feature or disabled otherwise.", null);
|
||||
}
|
||||
|
||||
CommandLine cmd = new CommandLine(spec);
|
||||
|
||||
cmd.getHelpSectionMap().put(SECTION_KEY_COMMAND_LIST, new SubCommandListRenderer());
|
||||
cmd.setExecutionExceptionHandler(new ExecutionExceptionHandler());
|
||||
|
||||
return cmd;
|
||||
|
@ -245,6 +248,7 @@ public final class Picocli {
|
|||
public static String parseConfigArgs(List<String> argsList) {
|
||||
StringBuilder options = new StringBuilder();
|
||||
Iterator<String> iterator = argsList.iterator();
|
||||
boolean expectValue = false;
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
|
@ -259,7 +263,16 @@ public final class Picocli {
|
|||
if (options.length() > 0) {
|
||||
options.append(ARG_SEPARATOR);
|
||||
}
|
||||
|
||||
options.append(key);
|
||||
|
||||
if (key.indexOf(ARG_KEY_VALUE_SEPARATOR) == -1) {
|
||||
// values can be set using spaces (e.g.: --option <value>)
|
||||
expectValue = true;
|
||||
}
|
||||
} else if (expectValue) {
|
||||
options.append(ARG_KEY_VALUE_SEPARATOR).append(key);
|
||||
expectValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,19 +295,25 @@ public final class Picocli {
|
|||
continue;
|
||||
}
|
||||
|
||||
addOption(commandSpec, name, description);
|
||||
addOption(commandSpec, name, description, mapper);
|
||||
}
|
||||
|
||||
addOption(commandSpec, "--features", "Enables a group of features. Possible values are: "
|
||||
+ String.join(",", Arrays.stream(Profile.Type.values()).map(
|
||||
type -> type.name().toLowerCase()).toArray((IntFunction<CharSequence[]>) String[]::new)));
|
||||
type -> type.name().toLowerCase()).toArray((IntFunction<CharSequence[]>) String[]::new)), null);
|
||||
}
|
||||
|
||||
private static void addOption(CommandLine.Model.CommandSpec commandSpec, String name, String description) {
|
||||
commandSpec.addOption(CommandLine.Model.OptionSpec.builder(name)
|
||||
private static void addOption(CommandLine.Model.CommandSpec commandSpec, String name, String description, PropertyMapper mapper) {
|
||||
CommandLine.Model.OptionSpec.Builder builder = CommandLine.Model.OptionSpec.builder(name)
|
||||
.description(description)
|
||||
.paramLabel("<value>")
|
||||
.type(String.class).build());
|
||||
.paramLabel(name.substring(2))
|
||||
.type(String.class);
|
||||
|
||||
if (mapper != null) {
|
||||
builder.completionCandidates(mapper.getExpectedValues());
|
||||
}
|
||||
|
||||
commandSpec.addOption(builder.build());
|
||||
}
|
||||
|
||||
public static List<String> getCliArgs(CommandLine cmd) {
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright 2021 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.cli;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
/**
|
||||
* A {@link picocli.CommandLine.IHelpSectionRenderer} based on Quarkus CLI to show subcomands in help messages.
|
||||
*/
|
||||
class SubCommandListRenderer implements CommandLine.IHelpSectionRenderer {
|
||||
// @Override
|
||||
public String render(CommandLine.Help help) {
|
||||
CommandLine.Model.CommandSpec spec = help.commandSpec();
|
||||
if (spec.subcommands().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
CommandLine.Help.Column commands = new CommandLine.Help.Column(24, 2, CommandLine.Help.Column.Overflow.SPAN);
|
||||
CommandLine.Help.Column descriptions = new CommandLine.Help.Column(spec.usageMessage().width() - 24, 2,
|
||||
CommandLine.Help.Column.Overflow.WRAP);
|
||||
CommandLine.Help.TextTable textTable = CommandLine.Help.TextTable.forColumns(help.colorScheme(), commands, descriptions);
|
||||
textTable.setAdjustLineBreaksForWideCJKCharacters(spec.usageMessage().adjustLineBreaksForWideCJKCharacters());
|
||||
|
||||
addHierarchy(spec.subcommands().values(), textTable, "");
|
||||
return textTable.toString();
|
||||
}
|
||||
|
||||
private void addHierarchy(Collection<CommandLine> collection, CommandLine.Help.TextTable textTable,
|
||||
String indent) {
|
||||
collection.stream().distinct().forEach(subcommand -> {
|
||||
// create comma-separated list of command name and aliases
|
||||
String names = String.join(", ", subcommand.getCommandSpec().names());
|
||||
String description = description(subcommand.getCommandSpec().usageMessage());
|
||||
textTable.addRowValues(indent + names, description);
|
||||
|
||||
Map<String, CommandLine> subcommands = subcommand.getSubcommands();
|
||||
if (!subcommands.isEmpty()) {
|
||||
addHierarchy(subcommands.values(), textTable, indent + " ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String description(CommandLine.Model.UsageMessageSpec usageMessage) {
|
||||
if (usageMessage.header().length > 0) {
|
||||
return usageMessage.header()[0];
|
||||
}
|
||||
if (usageMessage.description().length > 0) {
|
||||
return usageMessage.description()[0];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -27,7 +27,12 @@ import io.quarkus.bootstrap.runner.RunnerClassLoader;
|
|||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = Build.NAME,
|
||||
description = "%nCreates a new and optimized server image based on the options passed to this command. Once created, configuration will be read from the server image and the server can be started without passing the same options again. Some configuration options require this command to be executed in order to actually change a configuration. For instance, the database vendor.%n",
|
||||
header = "Creates a new and optimized server image based on the configuration options passed to this command.",
|
||||
description = {
|
||||
"Creates a new and optimized server image based on the configuration options passed to this command. Once created, configuration will be read from the server image and the server can be started without passing the same options again.",
|
||||
"",
|
||||
"Some configuration options require this command to be executed in order to actually change a configuration. For instance, the database vendor."
|
||||
},
|
||||
mixinStandardHelpOptions = true,
|
||||
usageHelpAutoWidth = true,
|
||||
optionListHeading = "%nOptions%n",
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2021 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.cli.command;
|
||||
|
||||
import picocli.AutoComplete;
|
||||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = "completion", version = "generate-completion " + CommandLine.VERSION,
|
||||
header = "Generate bash/zsh completion script for ${ROOT-COMMAND-NAME:-the root command of this command}.",
|
||||
helpCommand = false, headerHeading = "%n", commandListHeading = "%nCommands:%n",
|
||||
synopsisHeading = "%nUsage: ", optionListHeading = "Options:%n",
|
||||
description = {
|
||||
"Generate bash/zsh completion script for ${ROOT-COMMAND-NAME:-the root command of this command}.%nRun the following command to give `${ROOT-COMMAND-NAME:-$PARENTCOMMAND}` TAB completion in the current shell:",
|
||||
"",
|
||||
" source <(${PARENT-COMMAND-FULL-NAME:-$PARENTCOMMAND} ${COMMAND-NAME})",
|
||||
""},
|
||||
mixinStandardHelpOptions = false)
|
||||
public class Completion extends AutoComplete.GenerateCompletion {
|
||||
}
|
|
@ -22,7 +22,7 @@ import static org.keycloak.exportimport.ExportImportConfig.ACTION_EXPORT;
|
|||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = "export",
|
||||
description = "%nExport data from realms to a file or directory.%n",
|
||||
description = "Export data from realms to a file or directory.",
|
||||
mixinStandardHelpOptions = true,
|
||||
showDefaultValues = true,
|
||||
optionListHeading = "%nOptions%n",
|
||||
|
|
|
@ -24,7 +24,7 @@ import static org.keycloak.exportimport.Strategy.OVERWRITE_EXISTING;
|
|||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = "import",
|
||||
description = "%nImport data from a directory or a file.%n",
|
||||
description = "Import data from a directory or a file.",
|
||||
mixinStandardHelpOptions = true,
|
||||
showDefaultValues = true,
|
||||
optionListHeading = "%nOptions%n",
|
||||
|
|
|
@ -25,8 +25,13 @@ import picocli.CommandLine.Option;
|
|||
|
||||
@Command(name = "keycloak",
|
||||
usageHelpWidth = 150,
|
||||
header = "Keycloak - Open Source Identity and Access Management%n%nFind more information at: https://www.keycloak.org/%n",
|
||||
description = "Use this command-line tool to manage your Keycloak cluster%n", footerHeading = "%nUse \"${COMMAND-NAME} <command> --help\" for more information about a command.%nUse \"${COMMAND-NAME} options\" for a list of all command-line options.",
|
||||
header = {
|
||||
"Keycloak - Open Source Identity and Access Management",
|
||||
"",
|
||||
"Find more information at: https://www.keycloak.org/",
|
||||
""
|
||||
},
|
||||
description = "Use this command-line tool to manage your Keycloak cluster%n", footerHeading = "%nUse \"${COMMAND-NAME} <command> --help\" for more information about a command.",
|
||||
footer = "%nby Red Hat",
|
||||
optionListHeading = "Configuration Options%n%n",
|
||||
commandListHeading = "%nCommands%n%n",
|
||||
|
@ -41,7 +46,8 @@ import picocli.CommandLine.Option;
|
|||
StartDev.class,
|
||||
Export.class,
|
||||
Import.class,
|
||||
ShowConfig.class
|
||||
ShowConfig.class,
|
||||
Tools.class
|
||||
}
|
||||
)
|
||||
public final class Main {
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.keycloak.cli.command;
|
|||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = Start.NAME,
|
||||
description = "%nStart the server.%n",
|
||||
description = "Start the server.",
|
||||
mixinStandardHelpOptions = true,
|
||||
usageHelpAutoWidth = true,
|
||||
optionListHeading = "%nOptions%n",
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.keycloak.util.Environment;
|
|||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = StartDev.NAME,
|
||||
description = "%nStart the server in development mode.%n",
|
||||
description = "Start the server in development mode.",
|
||||
mixinStandardHelpOptions = true,
|
||||
optionListHeading = "%nOptions%n",
|
||||
parameterListHeading = "Available Commands%n")
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright 2021 Red Hat, Inc. and/or its affiliates
|
||||
* and other contributors as indicated by the @author tags.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.cli.command;
|
||||
|
||||
import picocli.CommandLine;
|
||||
|
||||
@CommandLine.Command(name = "tools",
|
||||
description = "Provides utilities for using and interacting with the server.",
|
||||
mixinStandardHelpOptions = true,
|
||||
optionListHeading = "%nOptions%n",
|
||||
parameterListHeading = "Available Commands%n",
|
||||
subcommands = {Completion.class})
|
||||
public class Tools {
|
||||
}
|
|
@ -18,8 +18,12 @@ package org.keycloak.configuration;
|
|||
|
||||
import static org.keycloak.util.Environment.getBuiltTimeProperty;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -44,6 +48,12 @@ public class PropertyMapper {
|
|||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, defaultValue, transformer, description));
|
||||
}
|
||||
|
||||
static PropertyMapper createWithDefault(String fromProperty, String toProperty, String defaultValue,
|
||||
BiFunction<String, ConfigSourceInterceptorContext, String> transformer, String description,
|
||||
Iterable<String> expectedValues) {
|
||||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, defaultValue, transformer, description, expectedValues));
|
||||
}
|
||||
|
||||
static PropertyMapper create(String fromProperty, String toProperty, BiFunction<String, ConfigSourceInterceptorContext, String> transformer, String description) {
|
||||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, null, transformer, null, description));
|
||||
}
|
||||
|
@ -60,10 +70,20 @@ public class PropertyMapper {
|
|||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, null, transformer, null, true, description, false));
|
||||
}
|
||||
|
||||
static PropertyMapper createBuildTimeProperty(String fromProperty, String toProperty,
|
||||
BiFunction<String, ConfigSourceInterceptorContext, String> transformer, String description,
|
||||
Iterable<String> expectedValues) {
|
||||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, null, transformer, null, true, description, false, expectedValues));
|
||||
}
|
||||
|
||||
static PropertyMapper createBuildTimeProperty(String fromProperty, String toProperty, String description) {
|
||||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, null, null, null, true, description, false));
|
||||
}
|
||||
|
||||
static PropertyMapper createBuildTimeProperty(String fromProperty, String toProperty, String description, Iterable<String> expectedValues) {
|
||||
return MAPPERS.computeIfAbsent(toProperty, s -> new PropertyMapper(fromProperty, s, null, null, null, true, description, false, expectedValues));
|
||||
}
|
||||
|
||||
static Map<String, PropertyMapper> MAPPERS = new HashMap<>();
|
||||
|
||||
static PropertyMapper IDENTITY = new PropertyMapper(null, null, null, null, null) {
|
||||
|
@ -83,30 +103,38 @@ public class PropertyMapper {
|
|||
private final BiFunction<String, ConfigSourceInterceptorContext, String> mapper;
|
||||
private final String mapFrom;
|
||||
private final boolean buildTime;
|
||||
private String description;
|
||||
private boolean mask;
|
||||
private final String description;
|
||||
private final boolean mask;
|
||||
private final Iterable<String> expectedValues;
|
||||
|
||||
PropertyMapper(String from, String to, String defaultValue, BiFunction<String, ConfigSourceInterceptorContext, String> mapper, String description) {
|
||||
this(from, to, defaultValue, mapper, null, description);
|
||||
}
|
||||
|
||||
PropertyMapper(String from, String to, String defaultValue, BiFunction<String, ConfigSourceInterceptorContext, String> mapper,
|
||||
String description, Iterable<String> expectedValues) {
|
||||
this(from, to, defaultValue, mapper, null, false, description, false, expectedValues);
|
||||
}
|
||||
|
||||
PropertyMapper(String from, String to, String defaultValue, BiFunction<String, ConfigSourceInterceptorContext, String> mapper, String mapFrom, String description) {
|
||||
this(from, to, defaultValue, mapper, mapFrom, false, description, false);
|
||||
}
|
||||
|
||||
|
||||
PropertyMapper(String from, String to, String defaultValue, BiFunction<String, ConfigSourceInterceptorContext, String> mapper, String mapFrom, boolean buildTime, String description, boolean mask) {
|
||||
this(from, to, defaultValue, mapper, mapFrom, buildTime, description, mask, Collections.emptyList());
|
||||
}
|
||||
|
||||
PropertyMapper(String from, String to, String defaultValue, BiFunction<String, ConfigSourceInterceptorContext, String> mapper,
|
||||
String mapFrom, boolean buildTime, String description, boolean mask, Iterable<String> expectedValues) {
|
||||
this.from = MicroProfileConfigProvider.NS_KEYCLOAK_PREFIX + from;
|
||||
this.to = to;
|
||||
this.defaultValue = defaultValue;
|
||||
if (mapper == null) {
|
||||
this.mapper = PropertyMapper::defaultTransformer;
|
||||
} else {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
this.mapper = mapper == null ? PropertyMapper::defaultTransformer : mapper;
|
||||
this.mapFrom = mapFrom;
|
||||
this.buildTime = buildTime;
|
||||
this.description = description;
|
||||
this.mask = mask;
|
||||
this.expectedValues = expectedValues == null ? Collections.emptyList() : expectedValues;
|
||||
}
|
||||
|
||||
ConfigValue getOrDefault(ConfigSourceInterceptorContext context, ConfigValue current) {
|
||||
|
@ -197,4 +225,8 @@ public class PropertyMapper {
|
|||
String getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public Iterable<String> getExpectedValues() {
|
||||
return expectedValues;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import static org.keycloak.provider.quarkus.QuarkusPlatform.addInitializationExc
|
|||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -72,7 +73,7 @@ public final class PropertyMappers {
|
|||
}
|
||||
|
||||
return enabled ? "enabled" : "disabled";
|
||||
}, "Enables the HTTP listener.");
|
||||
}, "Enables the HTTP listener.", Arrays.asList(Boolean.TRUE.toString(), Boolean.FALSE.toString()));
|
||||
createWithDefault("http.host", "quarkus.http.host", "0.0.0.0", "The HTTP host.");
|
||||
createWithDefault("http.port", "quarkus.http.port", String.valueOf(8080), "The HTTP port.");
|
||||
createWithDefault("https.port", "quarkus.http.ssl-port", String.valueOf(8443), "The HTTPS port.");
|
||||
|
@ -117,7 +118,8 @@ public final class PropertyMappers {
|
|||
}
|
||||
addInitializationException(Messages.invalidProxyMode(mode));
|
||||
return "false";
|
||||
}, "The proxy mode if the server is behind a reverse proxy. Possible values are: none, edge, reencrypt, and passthrough.");
|
||||
}, "The proxy mode if the server is behind a reverse proxy. Possible values are: none, edge, reencrypt, and passthrough.",
|
||||
Arrays.asList("none", "edge", "reencrypt", "passthrough"));
|
||||
}
|
||||
|
||||
private static void configureDatabasePropertyMappers() {
|
||||
|
@ -129,7 +131,8 @@ public final class PropertyMappers {
|
|||
}
|
||||
addInitializationException(invalidDatabaseVendor(db, "h2-file", "h2-mem", "mariadb", "mysql", "postgres", "postgres-95", "postgres-10"));
|
||||
return "h2";
|
||||
}, "The database vendor. Possible values are: h2-mem, h2-file, mariadb, mysql, postgres, postgres-95, postgres-10.");
|
||||
}, "The database vendor. Possible values are: h2-mem, h2-file, mariadb, mysql, postgres, postgres-95, postgres-10.",
|
||||
Arrays.asList("h2-file", "h2-mem", "mariadb", "mysql", "postgres", "postgres-95", "postgres-10"));
|
||||
create("db", "quarkus.datasource.jdbc.transactions", (db, context) -> "xa", null);
|
||||
create("db.url", "db", "quarkus.datasource.jdbc.url", (value, context) -> Database.getDefaultUrl(value).orElse(value), "The database JDBC URL. If not provided a default URL is set based on the selected database vendor. For instance, if using 'postgres', the JDBC URL would be 'jdbc:postgresql://localhost/keycloak'. The host, database and properties can be overridden by setting the following system properties, respectively: -Dkc.db.url.host, -Dkc.db.url.database, -Dkc.db.url.properties.");
|
||||
create("db.username", "quarkus.datasource.username", "The database username.");
|
||||
|
@ -142,9 +145,10 @@ public final class PropertyMappers {
|
|||
|
||||
private static void configureClustering() {
|
||||
createWithDefault("cluster", "kc.spi.connections-infinispan.quarkus.config-file", "default", (value, context) -> "cluster-" + value + ".xml", "Specifies clustering configuration. The specified value points to the infinispan configuration file prefixed with the 'cluster-` "
|
||||
+ "inside the distribution configuration directory. Supported values out of the box are 'local' and 'cluster'. Value 'local' points to the file cluster-local.xml and " +
|
||||
"effectively disables clustering and use infinispan caches in the local mode. Value 'default' points to the file cluster-default.xml, which has clustering enabled for infinispan caches.");
|
||||
create("cluster-stack", "kc.spi.connections-infinispan.quarkus.stack", "Specified the default stack to use for cluster communication and node discovery. Possible values are: tcp, udp, kubernetes, ec2, azure, google.");
|
||||
+ "inside the distribution configuration directory. Supported values out of the box are 'local' and 'default'. Value 'local' points to the file cluster-local.xml and " +
|
||||
"effectively disables clustering and use infinispan caches in the local mode. Value 'default' points to the file cluster-default.xml, which has clustering enabled for infinispan caches.",
|
||||
Arrays.asList("local", "default"));
|
||||
create("cluster-stack", "kc.spi.connections-infinispan.quarkus.stack", "Define the default stack to use for cluster communication and node discovery. Possible values are: tcp, udp, kubernetes, ec2, azure, google.");
|
||||
}
|
||||
|
||||
private static void configureHostnameProviderMappers() {
|
||||
|
@ -154,7 +158,8 @@ public final class PropertyMappers {
|
|||
}
|
||||
|
||||
private static void configureMetrics() {
|
||||
createBuildTimeProperty("metrics.enabled", "quarkus.datasource.metrics.enabled", "If the server should expose metrics and healthcheck. If enabled, metrics are available at the '/metrics' endpoint and healthcheck at the '/health' endpoint.");
|
||||
createBuildTimeProperty("metrics.enabled", "quarkus.datasource.metrics.enabled", "If the server should expose metrics and healthcheck. If enabled, metrics are available at the '/metrics' endpoint and healthcheck at the '/health' endpoint.",
|
||||
Arrays.asList(Boolean.TRUE.toString(), Boolean.FALSE.toString()));
|
||||
}
|
||||
|
||||
static ConfigValue getValue(ConfigSourceInterceptorContext context, String name) {
|
||||
|
|
Loading…
Reference in a new issue