Reference a settings variable in html head


I hope the question explains all, I am new to meteor and I am trying to get one-signal to manage notifications. It is required that I set the below code in the head, I have placed it in a layout.html. I am coming from a very different code background to meteor so im not sure what would even be best practice.
valueFromSettings is the value I need to access from settings, its hard coded right now and one signal is working fine

   var OneSignal = window.OneSignal || [];
     appId: "valueFromSettings",

Usually things like this go into a settings.json file which you load in dev with meteor --settings settings.json or in an ENV var in production

Client settings need to be children of a public key of the json:

  "public": {
    "oneSignalAppId": "example"

Which you can read with:

1 Like

If you really need to place it at the head of the html output, you will also need to check some undocumented functions

WebAppInternals.registerBoilerplateDataCallback can do what you want. Here is the code on how it works:


Hi @coagmano, thank you for your reply. I wish this was all I needed to get things going but the meteor code just does not work, I do have a settings file that works most places but my code runs inside a in the , this mean that I cannot reference it straight.


I am looking at that code now @rjdavid I was wondering what the alternative to placing the code in the head, one signal insist it be done in the documentation, but does it being within a prevent it being of any use anywhere else(as far as letting the see the settings.