使用env变量配置Jetty应用程序 [英] Configuring a Jetty application with env variables
问题描述
我试图使用Docker在Jetty 9中部署Java WAR文件。我想配置东西作为数据库URI字符串,loglevel等通过环境变量 - 所以我也可以使用Docker的链接功能。
I'm trying to deploy a Java WAR file in Jetty 9 with Docker. I would like to configure things as database URI string, loglevel and such via environment variables - so that I could also use the link features of Docker.
但是,如果我开始应用程序通过 java -jar start.jar
,我设置的环境变量不可用于应用程序。
But, if I start the application via java -jar start.jar
, the environment variables I've set are not available to the application.
推荐答案
使用系统环境变量(aka 系统。 Jetty的
start.jar
Using system environment variables (aka System.getenv(String)
) is not supported by Jetty's start.jar
但是请注意,Jetty start.jar
process支持属性,作为系统属性或作为开始属性。可以在命令行上或在 $ {jetty.base} /start.ini
Know however, that the Jetty start.jar
process does support properties, either as System properties, or as start properties. Either on the command line or in the ${jetty.base}/start.ini
这篇关于使用env变量配置Jetty应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!