dasniko / testcontainers-keycloak

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

add option to enable "--auto-build" #59

Closed piantino closed 2 years ago

piantino commented 2 years ago

I have a scenario with a custom provider with lib 3rd party libraries in the same package (fat jar). The jar is copied to the container, but I need to pass "auto-build" option to the keycloak, and this is not supported yet.

keycloak = new KeycloakContainer()
    .withCopyFileToContainer(MountableFile.forHostPath('path to fat jar'), "/opt/keycloak/providers/")
    .withRealmImportFile("/test-realm.json");
    .withAutoBuild() // My pull request
    .start();
dasniko commented 2 years ago

Thanks for this PR, but I'd rather not want to merge that. The auto-build flag is IMHO too much of internal handling, with wich I don't want users to bother with.

I'd have assumed that you implement a method like .withProviderLibsFrom() which sets the flag internally and also copies the given file into the container to the proper path, without forcing the user to know the internal path.

I'm also currently thinking of setting the auto-build flat as a default, no matter if it is really needed or not, because it's indeed needed in most cases. At the same time, there is a discussion at Keycloak at the moment, to also set the default start behavior to "default auto-build", what would align with my considerations.

dasniko commented 2 years ago

Side note: please don't merge any other branches, also not the main branch of this project, into your PR branch(es). Better is to rebase your changes onto the master branch. This leads to a leaner commit history. Thanks.