Hey Ray,

this was just an example. We actually used the property to set the JSON 
registry location for testing:

cas.service-registry.json.location=file:etc/cas/services

Also, Docker is in use and then you end up with something like that

1) docker run --rm -it -v $PWD/etc/cas/config:/etc/cas/config cas:latest

[...]
2020-06-25 12:45:14,401 WARN [org.apereo.cas.web.CasWebApplicationContext] 
- <Exception encountered during context initialization - cancelling refresh 
attempt: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'jsonServiceRegistry' defined in class path 
resource [org/apereo/cas/config/JsonServiceRegistryConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.apereo.cas.services.ServiceRegistry]: Factory method 
'jsonServiceRegistry' threw exception; nested exception is 
java.lang.IllegalArgumentException: /cas-overlay/etc/cas/services does not 
exist>

Configuration from the application-production.properties is used with value 
'/cas-overlay/etc/cas/services'

2a) docker run --rm -it -v $PWD/etc/cas/config:/etc/cas/config -e 
cas.service-registry.json.location=file:/foobar cas:latest
2b) docker run --rm -it -v $PWD/etc/cas/config:/etc/cas/config -e 
CAS.SERVICE_REGISTRY_JSON_LOCATION=file:/foobar cas:latest

We got the same result as above. The environment variable is not respected.

3) Same commands as above but we commented out 
'cas.service-registry.json.location' 
in the properties file

[...]
2020-06-25 12:47:48,725 WARN [org.apereo.cas.web.CasWebApplicationContext] 
- <Exception encountered during context initialization - cancelling refresh 
attempt: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'jsonServiceRegistry' defined in class path 
resource [org/apereo/cas/config/JsonServiceRegistryConfiguration.class]: 
Bean instantiation via factory method failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to instantiate 
[org.apereo.cas.services.ServiceRegistry]: Factory method 
'jsonServiceRegistry' threw exception; nested exception is 
java.lang.IllegalArgumentException: /foobar does not exist>

Only now, the environment variable's value is respected...

Very strange.
On Thursday, June 25, 2020 at 5:24:09 PM UTC+2 rbon wrote:

> Paul,
>
> Is the value in properties 'secrect' a typo?
> What about case, SECRET != secret?
>
> Ray
>
> On Thu, 2020-06-25 at 08:04 -0700, Paul Roemer wrote:
>
> Notice: This message was sent from outside the University of Victoria 
> email system. Please be cautious with links and sensitive information. 
>
>
> Hey guys,
>
> today we noticed that we are not able to override properties set in some 
> application properties file by environment variables. 
> For example, we have some property 'secrect' that we configure with value 
> 'unknown' in application-production.properties. Now, for the deployment we 
> want to override the property by setting the env variable SECRET=dontaskme. 
> But it fails and it's still 'unknown'. On the other hand after removing the 
> property 'secret' from the application-production.properties, the 
> environment variable is taken into account and the value is 'dontaskme'.
>
> So, does CAS not behave as normal Spring Boot applications when it comes 
> to property overrides?
>
> Cheers,
>   Paul
>
> -- 
>
> Ray Bon
> Programmer Analyst
> Development Services, University Systems
> 2507218831 <(250)%20721-8831> | CLE 019 | [email protected]
>
> I respectfully acknowledge that my place of work is located within the 
> ancestral, traditional and unceded territory of the Songhees, Esquimalt and 
> WSÁNEĆ Nations.
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/1b75e162-e25a-4915-a62e-1bc8744cbe24n%40apereo.org.

Reply via email to