service definition (in json) with system/environment variable

63 views
Skip to first unread message

Nebil Mabrouk

unread,
Aug 6, 2018, 1:11:38 PM8/6/18
to CAS Community
Hi all,

I'm using CAS 5.3.2, and I'm using JSON for service definition. 
I need to introduce a system variable in the value of some parameters in the JSON file, such as the following example: 

"publicKey" : {
"@class" : "org.apereo.cas.services.RegisteredServicePublicKeyImpl",
"location" : "${path.system.variable}/public.key",
...
}

Is there a way to do it? Thank you in advance.

Nebil

Peyo Tzolov

unread,
Oct 29, 2019, 11:03:59 AM10/29/19
to CAS Community
Hey, did you ever figure out how to do this?

Matthew Uribe

unread,
Oct 29, 2019, 12:11:45 PM10/29/19
to CAS Community
I've not tried this for the json service registry files, but I do use some system variables in my cas.properties. In order to do so, you have to set it in JAVA_OPTS

So, for the example in Nebil's post, assume ${path.system.variable} should be set to a path matching the $HOSTNAME of the host:
export JAVA_OPTS="$JAVA_OPTS -Dpath.system.variable=/${HOSTNAME}"

That way, again, I haven't tried this in the json file, only in the .properties file, the "location" : "${path.system.variable}/public.key", should be read as "location" : "/the_hostname_here/public.key",

I add my JAVA_OPTS to my setenv.sh file

Peyo Tzolov

unread,
Oct 29, 2019, 12:34:44 PM10/29/19
to CAS Community
Hi Matthew,

Thanks for your response. I have successfully used env variables in my cas.properties file, but when I tried to put it in the json service file it didn't work.
Reply all
Reply to author
Forward
0 new messages