2017-04-12 13:57:55 -04:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
const basePath = path.resolve('/var/run/secrets/')
|
|
|
|
|
|
|
|
function getSecret (secret) {
|
|
|
|
const filePath = path.join(basePath, secret)
|
|
|
|
if (fs.existsSync(filePath)) return fs.readFileSync(filePath)
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fs.existsSync(basePath)) {
|
|
|
|
module.exports = {
|
|
|
|
sessionsecret: getSecret('sessionsecret'),
|
|
|
|
sslkeypath: getSecret('sslkeypath'),
|
|
|
|
sslcertpath: getSecret('sslcertpath'),
|
|
|
|
sslcapath: getSecret('sslcapath'),
|
|
|
|
dhparampath: getSecret('dhparampath'),
|
|
|
|
s3: {
|
|
|
|
accessKeyId: getSecret('s3_acccessKeyId'),
|
|
|
|
secretAccessKey: getSecret('s3_secretAccessKey')
|
|
|
|
},
|
|
|
|
facebook: {
|
|
|
|
clientID: getSecret('facebook_clientID'),
|
|
|
|
clientSecret: getSecret('facebook_clientSecret')
|
|
|
|
},
|
|
|
|
twitter: {
|
|
|
|
consumerKey: getSecret('twitter_consumerKey'),
|
|
|
|
consumerSecret: getSecret('twitter_consumerSecret')
|
|
|
|
},
|
|
|
|
github: {
|
|
|
|
clientID: getSecret('github_clientID'),
|
|
|
|
clientSecret: getSecret('github_clientSecret')
|
|
|
|
},
|
|
|
|
gitlab: {
|
|
|
|
clientID: getSecret('gitlab_clientID'),
|
|
|
|
clientSecret: getSecret('gitlab_clientSecret')
|
|
|
|
},
|
2017-10-29 06:16:40 -04:00
|
|
|
mattermost: {
|
|
|
|
clientID: getSecret('mattermost_clientID'),
|
|
|
|
clientSecret: getSecret('mattermost_clientSecret')
|
|
|
|
},
|
2017-04-12 13:57:55 -04:00
|
|
|
dropbox: {
|
|
|
|
clientID: getSecret('dropbox_clientID'),
|
2018-01-18 11:25:08 -05:00
|
|
|
clientSecret: getSecret('dropbox_clientSecret'),
|
|
|
|
appKey: getSecret('dropbox_appKey')
|
2017-04-12 13:57:55 -04:00
|
|
|
},
|
|
|
|
google: {
|
|
|
|
clientID: getSecret('google_clientID'),
|
|
|
|
clientSecret: getSecret('google_clientSecret')
|
|
|
|
},
|
|
|
|
imgur: getSecret('imgur_clientid')
|
|
|
|
}
|
|
|
|
}
|