1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-01 07:30:07 +02:00
copilot/packages/cloudapi-gql/src/credentials.js

28 lines
614 B
JavaScript
Raw Normal View History

const json = (() => {
try {
2017-04-13 20:33:59 +03:00
const res = require('dotenv').config({
path: '../.env',
silent: true
2016-11-01 18:14:55 +02:00
});
2017-04-13 20:33:59 +03:00
if (res.error) {
2017-04-17 16:56:10 +03:00
throw res.error;
2017-04-13 20:33:59 +03:00
}
} catch (err) {
try {
return require('../credentials.json');
} catch (err) {
return {};
}
}
2017-04-13 20:33:59 +03:00
return {};
})();
module.exports = {
2017-04-28 01:11:12 +03:00
url: process.env.SDC_URL || json.SDC_URL || json.url || '',
account: process.env.SDC_ACCOUNT || json.SDC_ACCOUNT || json.account || '',
user: process.env.SDC_USER || json.SDC_USER || json.user || '',
keyId: process.env.SDC_KEY_ID || json.SDC_KEY_ID || json.keyId || ''
};