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

Environment information not properly propagated through to configuration loading #68

Open
karma0 opened this issue Aug 13, 2015 · 1 comment

Comments

@karma0
Copy link

karma0 commented Aug 13, 2015

In attempting to migrate new changes into the production DB for the first time, it was realized that the environment information isn't handled properly.

A workaround for the issue is:

NODE_ENV=production sails-migrations migrate

The issue appears to be that the configuration pulls in the default configuration under the assumption that the environment is development, not production, despite whether or not someone is using the '--env' flag. This was confirmed by running the following script to print out what the application is seeing:

const SailsIntegration = require('./node_modules/sails-migrations/lib/sails-migrations/helpers/sails_integration');
const path = require('path');

var modulesPath = path.join(process.cwd(), 'node_modules');
SailsIntegration.loadSailsConfig(modulesPath, function(err, cache) {
  console.log(cache);
});

For me, this was resulting in a connection refused error (ECONNREFUSED).

@RWOverdijk
Copy link
Collaborator

@karma0 Just took a quick peek, and it seems to not set the env. It does specify it as an option, but then doesn't use it.

I'm not sure how this should work. Perhaps it should be the third option (default) for commander, and perhaps it should be used to set the env in the config. It might be a while before I have time to look at this. A PR is more than welcome though :)

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

2 participants