From 6b1065b24da75bd0c61b72a76e3ee894d8f05ad3 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Thu, 5 Nov 2015 11:33:59 -0800 Subject: [PATCH] Don't print 'user: undefined' for the env profile for 'triton profile' if not defined --- lib/config.js | 5 ++++- lib/do_profile.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/config.js b/lib/config.js index 6b88b1b..bf28ab5 100644 --- a/lib/config.js +++ b/lib/config.js @@ -226,7 +226,10 @@ function _loadEnvProfile() { }; envProfile.account = process.env.TRITON_ACCOUNT || process.env.SDC_ACCOUNT; - envProfile.user = process.env.TRITON_USER || process.env.SDC_USER; + var user = process.env.TRITON_USER || process.env.SDC_USER; + if (user) { + envProfile.user = user; + } envProfile.url = process.env.TRITON_URL || process.env.SDC_URL; envProfile.keyId = process.env.TRITON_KEY_ID || process.env.SDC_KEY_ID; if (process.env.TRITON_TLS_INSECURE) { diff --git a/lib/do_profile.js b/lib/do_profile.js index 82f7149..2bfe646 100644 --- a/lib/do_profile.js +++ b/lib/do_profile.js @@ -47,7 +47,8 @@ function _showProfile(opts, cb) { Object.keys(profile).sort().forEach(function (key) { if (key === 'name') return; - console.log('%s: %s', key, profile[key]); + if (profile[key] !== undefined) + console.log('%s: %s', key, profile[key]); }); } }