diff --git a/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMapper.java b/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMapper.java index 6c51b196b08..34ffba81929 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMapper.java +++ b/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMapper.java @@ -127,6 +127,13 @@ public class PropertyMapper { ConfigValue config = context.proceed(from); if (config == null) { + // fist try runtime configuration + Optional buildConfig = getBuiltTimeConfig(from, context); + + if (buildConfig.isPresent()) { + return buildConfig.get(); + } + if (mapFrom != null) { // if the property we want to map depends on another one, we use the value from the other property to call the mapper String parentKey = MicroProfileConfigProvider.NS_KEYCLOAK + "." + mapFrom; @@ -145,12 +152,6 @@ public class PropertyMapper { } } - Optional buildConfig = getBuiltTimeConfig(from, context); - - if (buildConfig.isPresent()) { - return buildConfig.get(); - } - // if not defined, return the current value from the property as a default if the property is not explicitly set if (defaultValue == null || (current != null && !current.getConfigSourceName().equalsIgnoreCase("default values"))) { diff --git a/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMappers.java b/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMappers.java index 399cb721dca..99222e8469d 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMappers.java +++ b/quarkus/runtime/src/main/java/org/keycloak/configuration/PropertyMappers.java @@ -143,6 +143,7 @@ public final class PropertyMappers { return "org.mariadb.jdbc.MySQLDataSource"; case "mysql": return "com.mysql.cj.jdbc.MysqlXADataSource"; + case "postgress": case "postgres-95": case "postgres-10": return "org.postgresql.xa.PGXADataSource"; @@ -158,6 +159,7 @@ public final class PropertyMappers { return "mariadb"; case "mysql": return "mysql"; + case "postgres": case "postgres-95": case "postgres-10": return "postgresql"; @@ -165,22 +167,23 @@ public final class PropertyMappers { throw invalidDatabaseVendor(db, "h2-file", "h2-mem", "mariadb", "mysql", "postgres", "postgres-95", "postgres-10"); }, "The database vendor. Possible values are: h2-mem, h2-file, mariadb, mysql, postgres95, postgres10."); create("db", "quarkus.datasource.jdbc.transactions", (db, context) -> "xa", null); - create("db.url", "db", "quarkus.datasource.jdbc.url", (db, context) -> { - switch (db.toLowerCase()) { + create("db.url", "db", "quarkus.datasource.jdbc.url", (value, context) -> { + switch (value.toLowerCase()) { case "h2-file": return "jdbc:h2:file:${kc.home.dir:${kc.db.url.path:~}}/${kc.data.dir:data}/keycloakdb${kc.db.url.properties:;;AUTO_SERVER=TRUE}"; case "h2-mem": return "jdbc:h2:mem:keycloakdb${kc.db.url.properties:}"; case "mariadb": return "jdbc:mariadb://${kc.db.url.host:localhost}/${kc.db.url.database:keycloak}${kc.db.url.properties:}"; + case "postgres": case "postgres-95": case "postgres-10": return "jdbc:postgresql://${kc.db.url.host:localhost}/${kc.db.url.database:keycloak}${kc.db.url.properties:}"; case "mysql": return "jdbc:mysql://${kc.db.url.host:localhost}/${kc.db.url.database:keycloak}${kc.db.url.properties:}"; } - return null; - }, "The database JDBC URL. If not provided a default URL is set based on the selected database vendor. For instance, if using 'postgres-10', 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."); + return 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."); create("db.password", "quarkus.datasource.password", "The database password", true); create("db.schema", "quarkus.datasource.schema", "The database schema."); @@ -202,6 +205,7 @@ public final class PropertyMappers { }, "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.default.stack", "Specified the default stack to use for cluster communication and node discovery. Possible values are: tcp, udp, kubernetes, ec2."); } static ConfigValue getValue(ConfigSourceInterceptorContext context, String name) { diff --git a/testsuite/integration-arquillian/servers/auth-server/quarkus/assembly.xml b/testsuite/integration-arquillian/servers/auth-server/quarkus/assembly.xml index 02b9065cad2..338c6be7238 100644 --- a/testsuite/integration-arquillian/servers/auth-server/quarkus/assembly.xml +++ b/testsuite/integration-arquillian/servers/auth-server/quarkus/assembly.xml @@ -44,9 +44,9 @@ - src/main/content/conf/cluster-${auth.server.quarkus.config}.xml + src/main/content/conf/cluster-${auth.server.quarkus.cluster.config}.xml /auth-server-quarkus/conf - cluster.xml + cluster-${auth.server.quarkus.cluster.config}.xml true diff --git a/testsuite/integration-arquillian/servers/auth-server/quarkus/pom.xml b/testsuite/integration-arquillian/servers/auth-server/quarkus/pom.xml index ca2b8f27009..d07ccbb2b31 100644 --- a/testsuite/integration-arquillian/servers/auth-server/quarkus/pom.xml +++ b/testsuite/integration-arquillian/servers/auth-server/quarkus/pom.xml @@ -18,7 +18,7 @@ 2 2 2 - local + local @@ -199,7 +199,7 @@ auth-server-cluster-quarkus - ha + ha diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java index d1347f97956..f349eea7dc4 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/containers/KeycloakQuarkusServerDeployableContainer.java @@ -153,7 +153,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta commands.add("-Djboss.node.name=" + configuration.getRoute()); } - commands.add("--profile=" + System.getProperty("auth.server.quarkus.config", "local")); + commands.add("--cluster=" + System.getProperty("auth.server.quarkus.cluster.config", "local")); return commands.toArray(new String[commands.size()]); } diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index 067bff60c68..8fadfdc93a8 100755 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -229,7 +229,7 @@ false default - local + local @@ -621,7 +621,7 @@ ${auth.server.jboss.cluster} ${auth.server.jboss.legacy} ${auth.server.quarkus.cluster} - ${auth.server.quarkus.config} + ${auth.server.quarkus.cluster.config} ${auth.server.crossdc} @@ -756,7 +756,7 @@ - true true - ha + ha quarkus true false