changed env vars to SC

This commit is contained in:
Marius Pana 2018-02-10 18:29:30 +02:00
parent f7f86ae7d5
commit d589694608
1 changed files with 13 additions and 16 deletions

View File

@ -221,18 +221,18 @@ function validateProfile(profile, profilePath) {
try {
assert.string(profile.name, 'profile.name');
assert.string(profile.url,
profile.name === 'env' ? 'TRITON_URL or SDC_URL' : 'profile.url');
profile.name === 'env' ? 'SC_URL' : 'profile.url');
assert.string(profile.account,
profile.name === 'env' ? 'TRITON_ACCOUNT or SDC_ACCOUNT'
profile.name === 'env' ? 'SC_ACCOUNT'
: 'profile.account');
assert.string(profile.keyId,
profile.name === 'env' ? 'TRITON_KEY_ID or SDC_KEY_ID'
profile.name === 'env' ? 'SC_KEY_ID'
: 'profile.keyId');
assert.optionalBool(profile.insecure,
profile.name === 'env' ? 'TRITON_INSECURE or SDC_INSECURE'
profile.name === 'env' ? 'SC_INSECURE'
: 'profile.insecure');
assert.optionalString(profile.user,
profile.name === 'env' ? 'TRITON_USER or SDC_USER'
profile.name === 'env' ? 'SC_USER'
: 'profile.user');
assert.optionalString(profile.actAsAccount, 'profile.actAsAccount');
assert.optionalArrayOfString(profile.roles, 'profile.roles');
@ -276,21 +276,18 @@ function _loadEnvProfile(profileOverrides) {
name: 'env'
};
envProfile.account = process.env.TRITON_ACCOUNT || process.env.SDC_ACCOUNT;
var user = process.env.TRITON_USER || process.env.SDC_USER;
envProfile.account = process.env.SC_ACCOUNT;
var user = process.env.SC_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;
envProfile.url = process.env.SC_URL;
envProfile.keyId = process.env.SC_KEY_ID;
if (process.env.TRITON_TLS_INSECURE) {
if (process.env.SC_TLS_INSECURE) {
envProfile.insecure = common.boolFromString(
process.env.TRITON_TLS_INSECURE, undefined, 'TRITON_TLS_INSECURE');
} else if (process.env.SDC_TLS_INSECURE) {
envProfile.insecure = common.boolFromString(
process.env.SDC_TLS_INSECURE, undefined, 'SDC_TLS_INSECURE');
} else if (process.env.SDC_TESTING) {
process.env.SC_TLS_INSECURE, undefined, 'SC_TLS_INSECURE');
} else if (process.env.SC_TESTING) {
// For compatibility with the legacy behavior of the smartdc
// tools, *any* set value but the empty string is considered true.
envProfile.insecure = true;
@ -349,7 +346,7 @@ function loadProfile(opts) {
var envProfile = _loadEnvProfile(opts.profileOverrides);
if (!envProfile) {
throw new errors.ConfigError('could not load "env" profile '
+ '(missing TRITON_*, or SDC_*, environment variables)');
+ '(missing SC_* environment variables)');
}
return envProfile;
} else if (!opts.configDir) {