Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added possibility to add custom environment variables to an instance.…

… Fixes #21
  • Loading branch information...
commit 66cda30aee26862187ebcf7c135c201e05ea20d4 1 parent b5e87b3
@shimberger authored
Showing with 34 additions and 20 deletions.
  1. +10 −0 README.md
  2. +24 −20 usr/sbin/tomcat-server-manager
View
10 README.md
@@ -101,6 +101,16 @@ The relevant directories for this application are:
* /var/lib/tomcat-servers: This is where the runtime instance information (temp files, logs, ...) is stored
* /etc/tomcat-servers/: This is where the application and instance configuration is stored
+Environment Variables
+=====================
+
+You can add custom environment variables to an instance by editing it's conf/catalina.properties file
+with an entry in the following form.
+
+ env.MY_EVIRONMENT_VAR=my_value
+
+The variable will be made available to the instance.
+
Options
=======
View
44 usr/sbin/tomcat-server-manager
@@ -90,26 +90,30 @@ class InstanceManager:
def instance_environment(self,instance):
- properties = self.read_instance_properties(instance)
- environment = {
- "CATALINA_BASE": os.path.join(self.var_root,instance),
- "CATALINA_HOME": os.path.join(self.config_path,"tomcat-versions",properties["tsm.tomcat.version"],"catalina-home"),
- "APP_NAME": "tomcat-"+instance,
- "APP_LONG_NAME": "Tomcat instance " + instance,
- "WRAPPER_CONF": os.path.join(self.instances_path,instance,"conf","wrapper.conf"),
- "PIDDIR": os.path.join(self.var_root,instance,"run"),
- "RUN_AS_USER": properties["tsm.instance.user"],
- "CATALINA_DEBUG": properties["tsm.tomcat.debug"],
- "PRIORITY": "",
- "JAVA_HOME": properties["tsm.java.home"],
- "JAVA_JMXPORT": properties["tsm.port.jmx"],
- "JAVA_MAXMEMORY": properties["tsm.java.memory.max"],
- "JAVA_INITMEMORY": properties["tsm.java.memory.init"],
- "JAVA_MAXPERMSIZE": properties["tsm.java.memory.maxPermSize"],
- "WAIT_AFTER_STARTUP": '0',
- "SHELL": '/bin/dash',
- }
- return environment
+ properties = self.read_instance_properties(instance)
+ environment = {
+ "CATALINA_BASE": os.path.join(self.var_root,instance),
+ "CATALINA_HOME": os.path.join(self.config_path,"tomcat-versions",properties["tsm.tomcat.version"],"catalina-home"),
+ "APP_NAME": "tomcat-"+instance,
+ "APP_LONG_NAME": "Tomcat instance " + instance,
+ "WRAPPER_CONF": os.path.join(self.instances_path,instance,"conf","wrapper.conf"),
+ "PIDDIR": os.path.join(self.var_root,instance,"run"),
+ "RUN_AS_USER": properties["tsm.instance.user"],
+ "CATALINA_DEBUG": properties["tsm.tomcat.debug"],
+ "PRIORITY": "",
+ "JAVA_HOME": properties["tsm.java.home"],
+ "JAVA_JMXPORT": properties["tsm.port.jmx"],
+ "JAVA_MAXMEMORY": properties["tsm.java.memory.max"],
+ "JAVA_INITMEMORY": properties["tsm.java.memory.init"],
+ "JAVA_MAXPERMSIZE": properties["tsm.java.memory.maxPermSize"],
+ "WAIT_AFTER_STARTUP": '0',
+ "SHELL": '/bin/dash',
+ }
+ for key in properties:
+ if key.find("env.") == 0:
+ var_name = key[4:]
+ environment[var_name] = properties[key]
+ return environment
def available_version_configs(self,version,config = None):
configs = []
Please sign in to comment.
Something went wrong with that request. Please try again.