Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix: make the davster example work again

Nodester now honors the NODESTER env vars even if process.nodester is set. Also the usage hint (For more help, type <brand> help) now displays the correct brand.
  • Loading branch information...
commit 892e86f0a94a72203137dd9efa202da56aa35d05 1 parent 30a8ef6
@fgnass authored
Showing with 14 additions and 21 deletions.
  1. +14 −21 lib/commands.js
View
35 lib/commands.js
@@ -1,41 +1,34 @@
var log = require('./log');
- brand = "nodester",
- apihost = "api.nodester.com",
- apisecure = false,
env = process.env,
fs = require('fs');
-
-
+ cfg = process.nodester || (process.nodester = {})
process.argv = process.argv.slice(2);
if (env.NODESTER_APIHOST) {
- apihost = env.NODESTER_APIHOST;
+ cfg.apihost = env.NODESTER_APIHOST;
}
if (env.NODESTER_APISECURE) {
- apisecure = true;
+ cfg.apisecure = true;
}
if (env.NODESTER_BRAND) {
- brand = env.NODESTER_BRAND;
+ cfg.brand = env.NODESTER_BRAND;
}
-var nodester_config = {
- apisecure: apisecure,
- apihost: apihost,
- brand: brand,
+var defaults = {
+ apisecure: false,
+ apihost: "api.nodester.com",
+ brand: "nodester",
appname: '',
config: {
username: '',
password: ''
}
};
-if (!process.nodester) {
- process.nodester = {};
-}
-for (var i in nodester_config) {
- if (!process.nodester[i]) {
- process.nodester[i] = nodester_config[i];
+for (var i in defaults) {
+ if (!cfg[i]) {
+ cfg[i] = defaults[i];
}
}
@@ -89,8 +82,8 @@ exports.run = function(cmds, command) {
showHelp(exports.commands);
process.exit(1);
}
-
- if (!cmds[command] && process.nodester.appname) {
+
+ if (!cmds[command] && cfg.appname) {
command = 'app';
process.argv.unshift('app');
}
@@ -122,7 +115,7 @@ var showHelp = exports.showHelp = function(args) {
log.usage(i);
}
}
- log.info('For more help, type', brand, 'help <command>');
+ log.info('For more help, type', cfg.brand, 'help <command>');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.