service definition (in json) with system/environment variable

已查看 60 次
跳至第一个未读帖子

Nebil Mabrouk

未读,
2018年8月6日 13:11:382018/8/6
收件人 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

未读,
2019年10月29日 11:03:592019/10/29
收件人 CAS Community
Hey, did you ever figure out how to do this?

Matthew Uribe

未读,
2019年10月29日 12:11:452019/10/29
收件人 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

未读,
2019年10月29日 12:34:442019/10/29
收件人 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.
回复全部
回复作者
转发
0 个新帖子