[CAS 6.1.X] Building with custom profiles settings

76 views
Skip to first unread message

The Jej

unread,
Mar 19, 2019, 10:58:07 AM3/19/19
to CAS Community
Hello everyboy, 

I'm trying to make two different profiles on my cas project:

1 profile for development environment
1 profile for production

For the moment I have tested cas by using the default 'standalone' profile. SO I have created an application-standalone.properties, everything works fine and configuration inside that file works fine.


Now I would like to create a more production oriented configuration: 

application-dev.properties and application-prod.properties for example and tell gradlew to build cas using one or the other configuration file.

In my other springboot projects, I only have to use on the vm parameter: -Dspring.profiles.active=dev for example and the war generated take the application-dev.properties file


I'm trying the same thing with gradlew: gradlew.bat clean build -Dspring.profiles.active=dev

But it does nothing (I know it would be too simple :) ), I try to find more info on the documentation but I found that's the profiles configuration is not quite clear: https://apereo.github.io/cas/6.0.x/configuration/Configuration-Server-Management.html

Also it's not recommended to overlay default bootstrap.properties (witch sets spring.profiles.active=standalone) and application.properties so I try to avoid those solutions

How do you do to build with different configuration file ?

Thanks !

Jeremy

Julien Gribonvald

unread,
Mar 19, 2019, 11:07:35 AM3/19/19
to cas-...@apereo.org

Hi,

I'm running with the option -Dspring.profiles.active=standalone,test as example and I have a properties files named as test.properties and application-test.properties

This is working well on linux.

-Julien

--
- 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 cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/ff0d4f4e-5f64-40ed-964e-63f70827d5a4%40apereo.org.
--
Julien Gribonvald

Facundo Mateo

unread,
Mar 19, 2019, 11:59:53 AM3/19/19
to CAS Community
Hi jeremy,

Not sure if your profiles are just for configuration changes. 
Generally it is a good practice to separate application configuration from the app artifact it self.  One of the advantages  advantage is you don't need to generate a new app version or build each time you need a config change. 
CAS  has several solutions to this.

In case you want to use configurations files and standalone mode you could externalize configuration to filesystem. We used to manage configuration files for each environment this way using:

-Dcas.standalone.configurationDirectory=<path-to-configuration-files>

May be this is usefull in your domain.

Facundo

The Jej

unread,
Mar 20, 2019, 4:17:18 AM3/20/19
to CAS Community
Hello, thanks for you answers but I cannot manage to make one or the other param to work.

I'm using windows, my cas.properties and prod.properties are on d:/etc/cas/config.

I have an application-standalone.properties and application-prod.properties in my /src/main/resources

When I try: gradlew clean build run -Dspring.profiles.active=prod in logs I get:

2019-03-20 09:12:52,305 INFO [org.apereo.cas.configuration.DefaultCasConfigurationPropertiesSourceLocator] - <Configuration files
found at [\etc\cas\config] are [[file [D:\etc\cas\config\cas.properties]]] under profile(s) [[standalone]]>
2019-03-20 09:12:52,383 INFO [org.apereo.cas.web.CasWebApplication] - <The following profiles are active: standalone>


I also tried: gradlew clean build run -Dcas.standalone.configurationDirectory=d:\anotherdir

But params doesnt seems to be evaluated.

What am I doing wrong ?

Thanks !

Jeremy
Reply all
Reply to author
Forward
0 new messages