1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-10 21:30:06 +02:00

enable triton credentials from credentials.json

credentials can be set not only using ENV variables,
but also with credentials.json (if it is found)
This commit is contained in:
Sérgio Ramos 2016-10-20 02:13:04 +01:00 committed by Sérgio Ramos
parent 07351dde85
commit 8e832f9f03
2 changed files with 15 additions and 7 deletions

View File

@ -1,10 +1,4 @@
const credentials = { const credentials = require('../credentials');
url: process.env.SDC_URL,
account: process.env.SDC_ACCOUNT,
user: process.env.SDC_USER || '',
keyId: process.env.SDC_KEY_ID,
};
const auth = require('smartdc-auth'); const auth = require('smartdc-auth');
const cloudapi = require('triton/lib/cloudapi2'); const cloudapi = require('triton/lib/cloudapi2');
const bunyan = require('bunyan'); const bunyan = require('bunyan');

View File

@ -0,0 +1,14 @@
const json = (() => {
try {
return require('../credentials.json');
} catch (err) {
return {};
}
})();
module.exports = {
url: process.env.SDC_URL || json.url || '',
account: process.env.SDC_ACCOUNT || json.account || '',
user: process.env.SDC_USER || json.user || '',
keyId: process.env.SDC_KEY_ID || json.keyId || ''
};