Search code examples
quarkusquarkus-oidc

quarkus.oidc.auth-server-url for both testing and localhost development


I'm developing a Quarkus app with Keycloak for OIDC (OpenID Connect). During development, the app is running at localhost:8080 while Keycloak is running locally as well using Docker.

application.properties:

quarkus.oidc.auth-server-url=http://localhost:8484/auth/realms/my-sso

This is working fine.

Now I want to create some tests. https://quarkus.io/guides/security-openid-connect#wiremock told me to update application.properties as follows:

quarkus.oidc.auth-server-url=${keycloak.url}/auth/realms/my-sso

My question: How do I set that value only for testing. I don't want to keep toggling the values by commenting/uncommenting. If it's dictated by profile, what profiles to use?


Solution

  • Create an application properties file in the test resource folder. It will be used only for tests:

    src/test/resources/application.properties