简体   繁体   English

如何在运行时为使用sbt-native-packager捆绑的应用程序加载配置文件

[英]How to load configuration files for apps bundled using sbt-native-packager during runtime

I built a universal tarball using sbt-native-packager. 我使用sbt-native-packager构建了一个通用的tarball。 How do I load configuration files like c3p0 and application.conf from /etc/myapp or anyother custom location when I start the app. 启动应用程序时,如何从/ etc / myapp或任何其他自定义位置加载c3p0和application.conf之类的配置文件。

I don't want the config files to be part of the distribution tarball itself. 我不希望配置文件成为发行包本身的一部分。

I believe you can use typesafe config's "include" feature to grab from a direct location. 我相信您可以使用Typesafe配置的“包含”功能从直接位置抓取。

See https://github.com/typesafehub/config#features-of-hocon 参见https://github.com/typesafehub/config#features-of-hocon

That said, this would require you to create different configurations based on where you're installing, if you wanted a global file as the config file. 就是说,这需要您根据安装位置创建不同的配置,如果您想将全局文件用作配置文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM