Skip to content

Commit 5b71b13

Browse files
committed
Vapor will now prioritize ENV variables when logging in.
VAPOR_USER - username VAPOR_PASS - password
1 parent 233ef89 commit 5b71b13

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ util.inherits(Vapor, EventEmitter);
4141
Vapor.prototype.init = function(config) {
4242
this.config = config;
4343

44+
// Set login values from ENV variables if possible
45+
// Username needs to be preserved
46+
this.config.username = process.env.VAPOR_USER || config.username;
47+
this.config.password = process.env.VAPOR_PASS || config.password;
48+
4449
// Initiate our logger
4550
this.log = require('./logger')(config);
4651

@@ -85,6 +90,10 @@ Vapor.prototype._login = function(username, password) {
8590
this.client.logOn(loginOptions);
8691
};
8792

93+
/**
94+
* Plugin loader.
95+
* @private
96+
*/
8897
Vapor.prototype._loadPlugins = function() {
8998
var vapor = this;
9099
var config = this.config;
@@ -124,7 +133,7 @@ Vapor.prototype._loadPlugins = function() {
124133

125134
vapor.log.error(errors[0]);
126135
vapor.log.error(errors[1]);
127-
136+
128137
// Being able to load all plugins is critical, abort
129138
process.exit(1);
130139
}

0 commit comments

Comments
 (0)