radiegtya / meteoris2

a Realtime Javascript Boilerplate base on Meteor Js Framework
MIT License
246 stars 46 forks source link

ReferenceError: App is not defined #60

Open apaleja opened 9 years ago

apaleja commented 9 years ago

This is first time I am giving try to Meteoris, and I got these errors:

TypeError: Meteor.settings is undefined config.js:17:0 ReferenceError: App is not defined Images.js:8:0 ReferenceError: App is not defined mugenRoleActions.js:1:0 ReferenceError: App is not defined mugenRoleCollections.js:1:0 ReferenceError: App is not defined mugenRoleGroups.js:1:0 ReferenceError: App is not defined router.js:1:0

BTW, I am on windows.

fsoldera commented 9 years ago

Same error on Linux Mint.

radiegtya commented 9 years ago

@martinhbramwell : I think You should make clearer tutorial about this for starter users.

@apaleja & @fsoldera : thanks for reporting this. You can simply run meteor with this command

meteor --settings example.settings.json

This means, that you should setting up your meteor apps using your desired setting. Regards

radiegtya commented 9 years ago

btw @martinhbramwell, did You mind if You restructure the settings.json? I think this structure will be easier to read, maintainable, and easier to switch between production and development without change the value every switch them.

{
  "APP_ENV": "development", //change to production when ready
  "development": {
    "public": {
      "APP_VERSION": "0.9.8.3",
      "APP_ID": "73xWmYM6nKmMa5ERB",
      "APP_NAME": "Meteoris",      
      "ACTIVATE_MUGEN" : true,
      "APP_SERVER": "http://localhost:3000",
      "MONGO_URL": "mongodb://localhost:3001/meteor/"
    },
    "private": {//YOUR ANOTHER SETTING}
  }, 
  "production": {
    "public": {
      "APP_VERSION": "0.9.8.3",
      "APP_ID": "73xWmYM6nKmMa5ERB",
      "APP_NAME": "Meteoris",      
      "ACTIVATE_MUGEN" : false,
      "APP_SERVER": "http://YOUR_DOMAIN",
      "MONGO_URL": "mongodb://YOUR_MONGO_USERNAME:YOUR_MONGO_PASS@localhost:27017/YOUR_MONGO_DBNAME"
     },
     "private": {//YOUR ANOTHER SETTING}
  }
}

What do you think?

nb: don't forget to change the config.js file too.

martinhbramwell commented 9 years ago

The understandable rule is as defined in Meteor settings : If it is not explicitly public it is private. Internally, Meteor treats public vs private the way they want. It would be counter-productive to go against it :

Docs >> Full API >> Meteor.settings

martinhbramwell commented 9 years ago

I am trying to solve the broader issue :

Meteor forum question : How to create Meteor.settings.public within my app?

radiegtya commented 9 years ago

Hi @martinhbramwell, ok I am understand. But so many people asking me via email about this too. Would you mind to try fix the config.js? I think it will be better if people don't forced to setup the settings.json and give them the basic default setup at config.js too.

martinhbramwell commented 9 years ago

I am trying to do that. The problem is your App construct!

I eliminated the original problem (the requirement to edit /lib/applications/meteoris/configs/config.js manually), without realizing that Meteor won't allow Meteor.settings.public to be altered by client-side code. I got no answer about this from the forum yesterday,. because the forum was broken.

Meanwhile, users must copy example.settings.json to settings.json then edit settings.json then run meteor --settings=settings.json

That is an idiomatic initialization step used by most open source applications.

Finally, the more I look at it the less your App construct makes sense. Why doesn't UI.registerHelper() simply return values from Meteor.settings?

radiegtya commented 9 years ago

because not all people like to use Meteor.settings. And not much people know about it. hmm.. this weekend, I'll try to fix this thing up. If you don't mind, let's discuss more about it when you are free.

martinhbramwell commented 9 years ago

I got an answer in the forum with the correct solution. Stupidly, I thought there was some magic about Meteor.settings. There isn't, on the client side at least one can tack any old thing onto the Meteor object,

https://forums.meteor.com/t/how-to-create-meteor-settings-public-within-my-app/3854

radiegtya commented 9 years ago

I see, I'll merge and test it