MongoDB / Meteor / Export MONGO_URL to deployed applications

后端 未结 5 1481
忘了有多久
忘了有多久 2020-12-09 13:48

I tried to export a settings.json as documented in the meteor.js documentation in order to connect my Meteor.js app with an external MongoHQ database :

{
            


        
相关标签:
5条回答
  • 2020-12-09 14:04

    You are not able to use your own MONGO_URL with Meteor deploy hosting.

    Meteor deploy hosting takes care of the Email with Mailgun (if you use it), and provides mongodb for all apps deployed there.

    It is possible to change the MAIL_URL, but it is not possible to use a different mongodb.

    You can try, though im not sure it will work:

    Place this in your server side code somewhere

    process.env.MONGO_URL = '..';
    
    0 讨论(0)
  • 2020-12-09 14:22

    Create a lib folder under the server folder and write:

    Meteor.settings = { //your settings };
    

    According to documentation everything inside a folder named lib will be executed before anything, so this way we ensure that no code will be execute before this, preventing errors from accessing Metrics that don't exist.

    If you're already using the lib folder you've to named right to run before anything else that might conflict, check the docs about it.

    Enjoy.

    0 讨论(0)
  • 2020-12-09 14:23

    The application-configuration package (built in meteor package) contains the code to set mongo_url. See my answer here https://stackoverflow.com/a/23485319/2391620

    0 讨论(0)
  • 2020-12-09 14:29

    having a settings.json file is not enough you need to run with

     meteor --settings settings.json 
    

    which is you cant do with meteor.com deploy.

    0 讨论(0)
  • 2020-12-09 14:30

    Regarded to the Unoficial Meteor.js FAQ, thats not possible to do it easily, that might be tricky.

    So i signed up for a modulus Account, with MongoHQ Database. It works right now.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题