Read cache-ispn.xml from conf/ by default
Fixed #31492 Signed-off-by: Pedro Ruivo <pruivo@redhat.com> Signed-off-by: Alexander Schwartz <aschwart@redhat.com> Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
ff44d8dd98
commit
0e3554934e
4 changed files with 40 additions and 36 deletions
|
@ -0,0 +1,5 @@
|
|||
= Infinispan default XML configuration location
|
||||
|
||||
Previous releases ignored any change to `conf/cache-ispn.xml` if the `--cache-config-file` option was not provided.
|
||||
|
||||
Starting from this release, when `--cache-config-file` is not set, the default Infinispan XML configuration file is `conf/cache-ispn.xml` as this is both the expected behavior and the implied behavior given the docs of the current and previous releases.
|
|
@ -1,6 +1,10 @@
|
|||
[[migration-changes]]
|
||||
== Migration Changes
|
||||
|
||||
=== Migrating to 26.1.0
|
||||
|
||||
include::changes-26_1_0.adoc[leveloffset=3]
|
||||
|
||||
=== Migrating to 26.0.0
|
||||
|
||||
include::changes-26_0_0.adoc[leveloffset=3]
|
||||
|
|
|
@ -31,6 +31,7 @@ import liquibase.Scope;
|
|||
import liquibase.servicelocator.ServiceLocator;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.infinispan.commons.util.FileLookupFactory;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.Config;
|
||||
import org.keycloak.common.Profile;
|
||||
import org.keycloak.common.crypto.CryptoIntegration;
|
||||
|
@ -72,6 +73,8 @@ public class KeycloakRecorder {
|
|||
public static final String DEFAULT_HEALTH_ENDPOINT = "/health";
|
||||
public static final String DEFAULT_METRICS_ENDPOINT = "/metrics";
|
||||
|
||||
private static final Logger logger = Logger.getLogger(KeycloakRecorder.class);
|
||||
|
||||
public void initConfig() {
|
||||
Config.init(new MicroProfileConfigProvider());
|
||||
}
|
||||
|
@ -135,7 +138,10 @@ public class KeycloakRecorder {
|
|||
private String getInfinispanConfigFile() {
|
||||
String configFile = getKcConfigValue("spi-connections-infinispan-quarkus-config-file").getValue();
|
||||
|
||||
if (configFile != null) {
|
||||
if (configFile == null) {
|
||||
throw new IllegalArgumentException("Option 'configFile' needs to be specified");
|
||||
}
|
||||
|
||||
Path configPath = Paths.get(configFile);
|
||||
String path;
|
||||
|
||||
|
@ -145,6 +151,8 @@ public class KeycloakRecorder {
|
|||
path = configPath.getFileName().toString();
|
||||
}
|
||||
|
||||
logger.debugf("Infinispan configuration file: %s", path);
|
||||
|
||||
InputStream url = FileLookupFactory.newInstance().lookupFile(path, KeycloakRecorder.class.getClassLoader());
|
||||
|
||||
if (url == null) {
|
||||
|
@ -156,9 +164,6 @@ public class KeycloakRecorder {
|
|||
} catch (Exception cause) {
|
||||
throw new RuntimeException("Failed to read clustering configuration from [" + url + "]", cause);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Option 'configFile' needs to be specified");
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultUserProfileConfiguration(UPConfig configuration) {
|
||||
|
|
|
@ -6,15 +6,10 @@ import static org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper.
|
|||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.keycloak.config.CachingOptions;
|
||||
import org.keycloak.config.OptionBuilder;
|
||||
import org.keycloak.config.OptionCategory;
|
||||
import org.keycloak.infinispan.util.InfinispanUtils;
|
||||
import org.keycloak.quarkus.runtime.Environment;
|
||||
|
||||
|
@ -41,7 +36,7 @@ final class CachingPropertyMappers {
|
|||
if (CachingOptions.Mechanism.local.name().equals(value)) {
|
||||
return "cache-local.xml";
|
||||
} else if (CachingOptions.Mechanism.ispn.name().equals(value)) {
|
||||
return "cache-ispn.xml";
|
||||
return resolveConfigFile("cache-ispn.xml", null);
|
||||
} else
|
||||
return null;
|
||||
})
|
||||
|
@ -107,16 +102,11 @@ final class CachingPropertyMappers {
|
|||
}
|
||||
|
||||
private static String resolveConfigFile(String value, ConfigSourceInterceptorContext context) {
|
||||
String pathPrefix;
|
||||
String homeDir = Environment.getHomeDir();
|
||||
|
||||
if (homeDir == null) {
|
||||
pathPrefix = "";
|
||||
} else {
|
||||
pathPrefix = homeDir + File.separator + "conf" + File.separator;
|
||||
}
|
||||
|
||||
return pathPrefix + value;
|
||||
return homeDir == null ?
|
||||
value :
|
||||
homeDir + File.separator + "conf" + File.separator + value;
|
||||
}
|
||||
|
||||
private static String getDefaultKeystorePathValue() {
|
||||
|
|
Loading…
Reference in a new issue