dasniko / testcontainers-keycloak

A Testcontainer implementation for Keycloak IAM & SSO.
Apache License 2.0
339 stars 53 forks source link

Inject system properties into Docker environment #93

Closed EvgeniGordeev closed 1 year ago

EvgeniGordeev commented 1 year ago

Description

Is there a way to inject -Dkeycloak.migration.strategy=OVERWRITE_EXISTING ?

Motivation

Further customization of docker setup to provide more flexible ways of tailoring the KC configuration.

Details

In our tests we need to override master realm with a predefined configuration file.

dasniko commented 1 year ago

The -Dkeycloak.migration.strategy is an option from the legacy (Wildfly) Keycloak distribution. The current version (2.x) from this project doesn't support the legacy Keycloak anymore. Only the Quarkus distribution is supported. And with Quarkus, import on startup can only import new realms, no overwrites are possible, AFAIK. Other imports need a custom lifecycle of the container, which is not supported by this extension.

Possibly using the admin client and changing the configuration of the master-realm programmatically is be an option for you?

EvgeniGordeev commented 1 year ago

@dasniko you are right. After some debugging of quarkus distribution I found out that it's exactly the way you describe.