简体   繁体   中英

Can I use multiple settings.js files in Meteorjs?

I currently have a meteor application that is started with the following command:

meteor -p 3002 --settings ../settings.js

Inside settings.js I have a variety of variables, including some which are private (keys, etc) and some of which are more along the lines of global variables (actual settings).

I'd like to be able to have two settings files, one of which I could version control (the one with actual settings in it) and another which would be outside of version control (it would have keys, etc).

I would say that normally, I suppose the meteor way of doing this would be to use global variables somewhere inside the app for the settings. The reason I don't want to do it that way is because I have two different apps which should share these settings. There are a variety of complicated reasons that this is the case, but for now I don't really have any other way around it.

Thoughts for how I might be able to achieve this?

Specifying --settings multiple times won't merge the settings, so you could try using the METEOR_SETTINGS environment variable, but see this bug .

If that doesn't work either, it unfortunately sounds like JSON-merging (pre-processing) would be the way to go. See json-merge .

可能最好的做法是将您的共享设置放在一个包中,然后将该包包含在需要这些设置的任何应用程序中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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