Joe Dodd helped me get it from Cloud 9 to Heroku
Now when I move back to Cloud 9 my link to the database is broken, I'm trying to replace it with the environmental variable that was set by Heroku on Cloud 9 but use the .env file to load a different mLAB sandbox than Heroku had set, mainly because I assumed it would not allow connections from any other source than the Heroku App that had made it..
and I need to understand NODE.env better, it appears to function at a separate level on cloud 9
but the point should be to minify development to production like a toggle switch on the same repo, I just made this fork https://github.com/TurtleWolf/flf8080 to experiment with first.
I've added the .env & .env.default files
but not sure if or where to call dotenv, it just says as early as possible.. my guess is top of main.js
so where 'should' I include it in loopback.. main.js or server.js?
or should I be passing it into the callback of loopback?
'use strict';
var loopback = require('loopback');
var boot = require('loopback-boot');
// feels like it should go here, but I'm still misig something..
// or should I be passing it into the callback of loopback?
//require('dotenv').config();
var app = module.exports = loopback();
app.start = function() {
// start the web server
return app.listen(function() {
app.emit('started');
var baseUrl = app.get('url').replace(/\/$/, '');
console.log('Web server listening at: %s', baseUrl);
if (app.get('loopback-component-explorer')) {
var explorerPath = app.get('loopback-component-explorer').mountPath;
console.log('Browse your REST API at %s%s', baseUrl, explorerPath);
}
});
};
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname, function(err) {
if (err) throw err;
// start the server if `$ node server.js`
if (require.main === module)
app.start();
});
Joe Dodd helped me get it from Cloud 9 to Heroku Now when I move back to Cloud 9 my link to the database is broken, I'm trying to replace it with the environmental variable that was set by Heroku on Cloud 9 but use the .env file to load a different mLAB sandbox than Heroku had set, mainly because I assumed it would not allow connections from any other source than the Heroku App that had made it.. and I need to understand NODE.env better, it appears to function at a separate level on cloud 9 but the point should be to minify development to production like a toggle switch on the same repo, I just made this fork https://github.com/TurtleWolf/flf8080 to experiment with first. I've added the .env & .env.default files
and then trying to reference _MONGODBURI in
/server/datasources.json
dynamic datasource ${SOME_STRING}
Node environment variables
but not sure if or where to call dotenv, it just says as early as possible.. my guess is top of main.js so where 'should' I include it in loopback.. main.js or
server.js?
or should I be passing it into the callback of loopback?