how to change cas.properties location

1,396 views
Skip to first unread message

Chao

unread,
Jun 10, 2016, 1:26:54 PM6/10/16
to CAS Community
how can I change propertyfileconfigurer to point to an absolute path?
becuz here it is relative to the cas folder.

    <util:properties id="casProperties" location="${cas.properties.config.location:/WEB-INF/cas.properties}"/>

    <context:property-placeholder properties-ref="casProperties"/>

Misagh Moayyed

unread,
Jun 10, 2016, 2:04:13 PM6/10/16
to CAS Community

Start your container with a defined system/environment variable that is: “cas.properties.config.location=/etc/cas/cas.properties”, etc.

 

--
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 post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/1a541ff8-9ddd-4e2f-b570-e5fdb6db0b88%40apereo.org.
For more options, visit https://groups.google.com/a/apereo.org/d/optout.

Chao

unread,
Jun 11, 2016, 7:57:18 AM6/11/16
to CAS Community
and what will be the
<util:properties id="casProperties" location="${cas.properties.config.location:/WEB-INF/cas.properties}"/>
in xml file?

Misagh Moayyed

unread,
Jun 11, 2016, 12:33:39 PM6/11/16
to Chao, CAS Community

You don't modify that file at all.

--Misagh
--
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 post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.

Chao

unread,
Jul 6, 2016, 2:35:55 PM7/6/16
to CAS Community
I edited this file in ubuntu: /etc/environment and added “cas.properties.config.location=/etc/cas/cas.properties”
but this doesnt work. I also read that environment variables containing dot cannot be defined in linux
what should I do?

Ray Bon

unread,
Jul 6, 2016, 3:32:41 PM7/6/16
to cas-...@apereo.org
If you are trying to externalize your configuration you can add something like this to spring-configuration/propertyFileConfigurer.xml

      
    <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>/WEB-INF/cas.properties</value>
                <value>file:/etc/cas/cas-tier.properties</value>
            </list>
        </property>
    </bean>

Leave cas.properties where it is and create an new properties file with items that are more frequently changed or differ by deployment.

Ray
--
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 post to this group, send email to cas-...@apereo.org.
Visit this group at https://groups.google.com/a/apereo.org/group/cas-user/.

Chris Peck

unread,
Jul 6, 2016, 6:10:00 PM7/6/16
to Ray Bon, CAS Community
Here's our propertyFileConfigurer.xml it uses the environment cariable CASCONFIGDIR to load 2 different properties files which contain definitions for various things.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
	<description>
		This file lets CAS know where you've stored the cas.properties file which details some of the configuration options
		that are specific to your environment.  You can specify the location of the file here.  You may wish to place the file outside
		of the Servlet context if you have options that are specific to a tier (i.e. test vs. production) so that the WAR file 
		can be moved between tiers without modification.
		WM NOTE:
		Locations are defined at runtime by Tomcat, look for the setenv.sh file, or,
		add this after the JAVA_OPTS= line in /etc/default/tomcat7, for example:
		JAVA_OPTS="${JAVA_OPTS} -DCASCONFIGDIR=/etc/tomcat7"
	</description>

       
	<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>${CASCONFIGDIR}/cas.properties</value>
				<value>${CASCONFIGDIR}/wm.properties</value>
			</list>
		</property>
	</bean>	
</beans>

---
Chris Peck
Manager of *nix Engineering
Information Technology
College of William and Mary
Williamsburg, VA 23187

Reply all
Reply to author
Forward
0 new messages