RE: Can I pass values to application configuration file on command line

2008-07-23 Thread robert.purvis
You could use a script to edit your appconfig.xml with the value. Try the
replace command that comes with MySQL:

APP_PATH=/my/app/lives/here
replace to-be-replaced $APP_PATH -- appconfig.xml

Then do your tomcat startup as you have suggested by setting a system
property on the command line with $APP_PATH


Rob

-Original Message-
From: Jim Cant [mailto:[EMAIL PROTECTED] 
Sent: 23 July 2008 15:51
To: users@tomcat.apache.org
Subject: Can I pass values to application configuration file on command line

Is there a way I can use replaceable parameters in an application's xml
configuration file and pass a value in on the Tomcat command line.  In
particular, I would like to set the value of docBase so that I can launch
tomcat and have it find my app in different locations without having to edit
the xml config file.

For example, in the application config file
   (say, $TOMCAT_HOME/conf/Catalina/localhost/myAppConfig.xml)
put something like

Context path=/theAppPathdocBase=${APP_PATH} ...

so that ${APP_PATH} (or whatever the correct syntax is) gets replaced when
Tomcat is started with something like

$TOMCAT_HOME/bin/startup  ... -DAPP_PATH=/my/app/lives/here ...

and have the value for the variable replace the placeholder in the config
file.

Thanks a lot,

Jim Cant


 


-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



***
This  message  may  contain  confidential and  privileged  information.
If you  are not the  intended recipient  you should not  disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents.  To do so is strictly  prohibited and may be unlawful.
Please  inform  the  sender that  this  message has  gone astray before
deleting it.  Thank you.

2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS  and  would like  an NHSmail  email account, go
to: www.connectingforhealth.nhs.uk/nhsmail
***


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can I pass values to application configuration file on command line

2008-07-23 Thread Christopher Schultz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jim,

Jim Cant wrote:
| Is there a way I can use replaceable parameters in an application's xml
| configuration file and pass a value in on the Tomcat command line.  In
| particular, I would like to set the value of docBase so that I can launch
| tomcat and have it find my app in different locations without having
to edit
| the xml config file.

We use ant for this purpose. We just create a server.xml template with
replaceable parameters embedded in the file and then use ant's filtering
capability when copying the template to the actual deployment location
to do the replacements for us.

I don't know if that fits into your deployment strategy, but we've kind
of built ours around that, so it works well for us ;)

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiHT2QACgkQ9CaO5/Lv0PC+fQCfexAq2LSyHpNk7aTVVd05A/Sf
cD0An1tDsy/DuEyrZlnRIxR0fwrr43Uk
=urBA
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can I pass values to application configuration file on command line

2008-07-23 Thread Bill Barker

Jim Cant [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Is there a way I can use replaceable parameters in an application's xml
 configuration file and pass a value in on the Tomcat command line.  In
 particular, I would like to set the value of docBase so that I can launch
 tomcat and have it find my app in different locations without having to 
 edit
 the xml config file.

 For example, in the application config file
   (say, $TOMCAT_HOME/conf/Catalina/localhost/myAppConfig.xml)
 put something like

Context path=/theAppPathdocBase=${APP_PATH} ...

 so that ${APP_PATH} (or whatever the correct syntax is) gets replaced when
 Tomcat is started with something like

$TOMCAT_HOME/bin/startup  ... -DAPP_PATH=/my/app/lives/here ...


This won't work, but (assuming that you have a reasonably receint Tomcat) if 
you create a setenv.sh in the $CATALINA_HOME/bin directory that includes:
  CATALINA_OPTS=-DAPP_PATH=/my/app/lives/here
  export CATALINA_OPTS
then Tomcat will perform the variable replacement when parsing the 
context.xml file.

 and have the value for the variable replace the placeholder in the config
 file.

 Thanks a lot,

 Jim Cant





 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]