Property File Naming

47 views
Skip to first unread message

jeffm...@gmail.com

unread,
Nov 5, 2014, 3:54:10 PM11/5/14
to eureka_...@googlegroups.com, jva...@grubhub.com
I'm trying to get Eureka's config nailed down for our environments and I'm having some issues.

If I have eureka-client-test.properties and eureka-server-test.properties and then start the service with -Deureka.environment=test the correct config is pulled. I would like to have specific config files for each region and AWS account but anything besides test either causes Eureka to not start or to just use the eureka-server.properties and eureka-client.properties. Is it possible to get around this? My end goal is to have something like

eureka-server-preprod.properties
eureka-client-preprod.properties
eureka-server-prod.properties
eureka-client-prod.properties

And then be able to call them when the jar is started.

tb...@netflix.com

unread,
Nov 10, 2014, 1:20:38 PM11/10/14
to eureka_...@googlegroups.com, jva...@grubhub.com, jeffm...@gmail.com
You are doing this right. In my environment, if I export my user specific config, I can see Eureka server loads it properly:

export JAVA_OPTS="-Deureka.environment=tbak"
./catalina.sh run

2014-11-10 09:35:27,957 INFO  com.netflix.config.util.ConfigurationUtils:180 [main] [getConfigFromPropertiesFile] Loaded properties file file:/mnt/hgfs/tbak/projects/tools/apache-tomcat-6.0.41/webapps/eureka/WEB-INF/classes/eureka-server.properties
2014-11-10 09:35:27,986 INFO  com.netflix.config.util.ConfigurationUtils:180 [main] [getConfigFromPropertiesFile] Loaded properties file file:/mnt/hgfs/tbak/projects/tools/apache-tomcat-6.0.41/webapps/eureka/WEB-INF/classes/eureka-server-tbak.properties
2014-11-10 09:35:27,995 INFO  com.netflix.config.util.ConfigurationUtils:180 [main] [getConfigFromPropertiesFile] Loaded properties file file:/mnt/hgfs/tbak/projects/tools/apache-tomcat-6.0.41/webapps/eureka/WEB-INF/classes/eureka-client.properties
2014-11-10 09:35:27,997 INFO  com.netflix.config.util.ConfigurationUtils:180 [main] [getConfigFromPropertiesFile] Loaded properties file file:/mnt/hgfs/tbak/projects/tools/apache-tomcat-6.0.41/webapps/eureka/WEB-INF/classes/eureka-client-tbak.properties

If you look into eureka-server.properties, you will find this line there:
@next=eureka-${environment}-${region}.properties

This defines extra configuration file that will be loaded, on top of the default files. You can use this for region specific configuration. To use environment variables to control environment/region change this to:
@next=eureka-server-${@environment}-${@region}.properties

/Tomasz
Reply all
Reply to author
Forward
0 new messages