Deployment with meteor build and settings.json

So, I haven’t found a good answer to this, but I want to be able to have my Meteor.settings.public available on my deployed app. We are using meteor build, so AFAIK, the --settings settings.json flag isn’t available for that. I looked into exporting the Meteor.settings as part of my env_settings.sh file, as export METEOR_SETTINGS=$(cat settings.json), but I don’t see the Meteor.settings.public in the browser console. Any suggestions on how to achieve this for deployment? Thanks!

1 Like

Github issue - https://github.com/meteor/meteor/issues/6657

1 Like

If you’re on 1.3 you should try window.Meteor.settings.public in the console. Alternatively, in the code you need this ability use import {Meteor} from 'meteor/meteor'.

1 Like

So when I console.log(Meteor.settings) in the browser console, I get Object {public: {}}

My bad. I didn’t dig far enough into the settings object.

So as per this, METEOR_SETTINGS is only populated if using the meteor build command - i.e., for production. I have to try this, but it seems a little weird that I can’t export the settings to test in development before pushing to production. Hopefully this works okay!

So this works. Again, just feels weird that I can’t export METEOR_SETTINGS in development.