Harry
Harry

Reputation: 55029

Meteor client side settings

Is there a good way to store client side settings for meteor that would be load before any other javascript?

I would put things like api ids and other such into it.

Upvotes: 8

Views: 5751

Answers (1)

Tarang
Tarang

Reputation: 75975

If you're not doing any kind of initialization, i.e just storing values such as your api keys you can:

1) Have a settings.json file containing your settings in your project dir e.g

{ 
   "public" : {
       "api_key":"value1"
   }
}

Then start meteor with this settings file

meteor --settings settings.json

Access this value on your client via:

Meteor.settings.public.api_key
=> "value1"

Upvotes: 16

Related Questions