ubuntu 12.10上的码头等环境 [英] jetty and etc environment on ubuntu 12.10
问题描述
在IntelliJ下运行jetty项目时,我可以使用System.getenv("var1")api读取设置为/etc/environment的环境变量没有问题.
When running jetty project under IntelliJ I have no problem to read environment variable I set to /etc/environment using the System.getenv("var1") api.
当我将战争部署到在启动时启动Jetty的Ubuntu服务器时,调用System.getenv("var1")会得到null
When I deploy the war to Ubuntu server that start Jetty at boot, I get null when calling System.getenv("var1")
当我在我的用户(suder用户)下的服务器上运行一个简单的控制台应用程序时,当前会获得环境变量.
When I run a simple console application on the server under my user (suder user) I get the environment variable currently.
我需要做些什么,以便使/etc/environment中的环境变量在战争(而不是在用户会话下)自动启动时对战争可见?
What I need to do in order to make the environment variables in /etc/environment visible to the war when it start automatically not under a user session?
推荐答案
当我要使弹性豆茎上的东西工作时,我认为需要在jetty.sh中对此进行调整...
I think I needed to adjust this in the jetty.sh when I was getting things working on elastic beanstalk...
在jetty.sh脚本中,您可以获取/etc/environment文件的源代码,并且该文件将存在.如果您正在寻找它,那么请为它打开一个错误,然后将其添加到jetty.sh脚本中以供下一个版本使用.
In the jetty.sh script you can source the /etc/environment file and they will be present. If that is what you are looking for then open a bug for it and we'll add it into the jetty.sh script for the next release.
这篇关于ubuntu 12.10上的码头等环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!