You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Baranski <li...@secmgmt.com> on 2009/09/30 16:18:15 UTC

Getting arbitrary environment variables from webapp

Is there a way I can specify an environment variable via the startup.sh that
I can then use System.getenv("MYWEBAPP_CONFIG_FILE");  to get it from within
my application?

I need to store a file outside of the webroot to read configuration from, so
that if a user changes this file, it will not get overwritten when an app is
re-deployed.

Thanks,
Mike.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Getting arbitrary environment variables from webapp

Posted by Mike Baranski <li...@secmgmt.com>.
Thanks!

>-----Original Message-----
>From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
>Sent: Wednesday, September 30, 2009 3:47 PM
>To: Tomcat Users List
>Subject: RE: Getting arbitrary environment variables from webapp
>
>> From: Mike Baranski [mailto:list-subscriptions@secmgmt.com]
>> Subject: Getting arbitrary environment variables from webapp
>>
>> Is there a way I can specify an environment variable via
>> the startup.sh
>
>Create a setenv.sh script in Tomcat's bin directory and export whatever
>variables you need there.  The startup.sh script calls setenv.sh
>automatically if it exists.
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Getting arbitrary environment variables from webapp

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mike Baranski [mailto:list-subscriptions@secmgmt.com]
> Subject: Getting arbitrary environment variables from webapp
> 
> Is there a way I can specify an environment variable via
> the startup.sh

Create a setenv.sh script in Tomcat's bin directory and export whatever variables you need there.  The startup.sh script calls setenv.sh automatically if it exists.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org