Skip to content

Commit 4f5aa51

Browse files
committed
Adding support for environment option.
1 parent f1eb3d3 commit 4f5aa51

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/gruntTasks.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ module.exports = function (grunt) {
6868
var name = grunt.option('name');
6969
var sails;
7070
var args;
71+
var env;
7172

7273
if (!command) {
7374
usage(grunt);
@@ -76,11 +77,17 @@ module.exports = function (grunt) {
7677

7778
args = buildDbMigrateArgs(grunt, command);
7879

80+
if (grunt.option('env')){
81+
env = grunt.option('env');
82+
}else{
83+
env = process.env.NODE_ENV;
84+
}
85+
7986
// lift Sails to get the effective configuration. We don't actually need to
8087
// run it, and we certainly don't want any log messages. We just want the
8188
// config.
8289
sails = new Sails();
83-
sails.lift({ port: -1, log: { level: 'silent' } }, function (err) {
90+
sails.lift({ port: -1, log: { level: 'silent' }, environment: env }, function (err) {
8491
var url;
8592

8693
if (err) {

0 commit comments

Comments
 (0)