Keycloak.X Property replacement via environment variables not working

74 views
Skip to first unread message

Benjamin Weimer

unread,
Nov 26, 2021, 5:23:53 AM11/26/21
to Keycloak User
Hi,

as described here [1] it should be possible to use environment variables
to define properties in keyclock.properties. Property replacement works
fine with system properties but sadly not with environment variables. Is
this currently broken or do I need to do anything special to use the
environment variable mechanism?

Kind regards
Benjamin


[1]
https://github.com/keycloak/keycloak-community/blob/main/design/keycloak.x/configuration.md#property-replacement


Dominik Guhr

unread,
Nov 26, 2021, 6:34:42 AM11/26/21
to Benjamin Weimer, Keycloak User
Hey Benjamin,

thanks for reaching out! Could you pls describe:
a) which version you are using? 15.0.2 or latest main? There were tons of changes.
b) the steps you have tried? There's no generally known bug for this atm.

Best regards,
Dominik 

--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/1cbbe0a1-2187-5caa-a019-1c81abec49f9%40gmail.com.

Benjamin Weimer

unread,
Nov 26, 2021, 6:38:19 AM11/26/21
to Dominik Guhr, Keycloak User
Hi Dominik,

I used Keycloak version 15.0.2 and did something like adding a property in keycloak.properties:

spi.hostname.default.frontend-url=${env.MY_KC_URL}

Then I set MY_KC_URL environment variable and run kc.sh to start Keycloak.X. The property was treated as empty.

Kind regards
Benjamin

Dominik Guhr

unread,
Nov 26, 2021, 7:10:02 AM11/26/21
to Benjamin Weimer, Keycloak User
It should suffice to just remove the env..., so instead of 
spi.hostname.default.frontend-url=${env.MY_KC_URL}
please try 
spi.hostname.default.frontend-url=${MY_KC_URL}
and set the environment variable 

Benjamin Weimer

unread,
Nov 26, 2021, 7:27:50 AM11/26/21
to Dominik Guhr, Keycloak User
Ahh okay, thanks I'll try that. Is it possible to update the documentation in this case? https://github.com/keycloak/keycloak-community/blob/main/design/keycloak.x/configuration.md#property-replacement
Reply all
Reply to author
Forward
0 new messages