Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: App is not defined #60

Open
apaleja opened this issue May 2, 2015 · 10 comments
Open

ReferenceError: App is not defined #60

apaleja opened this issue May 2, 2015 · 10 comments

Comments

@apaleja
Copy link

apaleja commented May 2, 2015

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
Copy link

fsoldera commented May 2, 2015

Same error on Linux Mint.

@radiegtya
Copy link
Owner

@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
Copy link
Owner

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
Copy link
Contributor

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
Copy link
Contributor

I am trying to solve the broader issue :

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

@radiegtya
Copy link
Owner

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
Copy link
Contributor

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
Copy link
Owner

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
Copy link
Contributor

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
Copy link
Owner

I see, I'll merge and test it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants