diff options
author | Wu Cheng-Han | 2017-03-23 20:00:48 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2017-03-23 20:00:48 +0800 |
commit | dde6e622a4de07059a417436c42ce4df44aa43f7 (patch) | |
tree | 299ee4f987873fc16b5d0025211a1b1f9fbb5dd9 /app.js | |
parent | 7e3b74d0da9d06636fb2e96efff7912127b1ad5d (diff) |
Fix front-end constants generation not getting config properly
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -30,15 +30,19 @@ var response = require('./lib/response.js') var models = require('./lib/models') // generate front-end constants by template +var configJson = config.raw var constpath = path.join(__dirname, './public/js/lib/common/constant.ejs') +var googleApiKey = (fs.existsSync('/run/secrets/google_apiKey') && config.handleDockerSecret('google_apiKey')) || process.env.HMD_GOOGLE_API_KEY || (configJson.google && configJson.google.apiKey) || '' +var googleClientID = (fs.existsSync('/run/secrets/google_clientID') && config.handleDockerSecret('google_clientID')) || process.env.HMD_GOOGLE_CLIENT_ID || (configJson.google && configJson.google.clientID) || '' +var dropboxAppKey = (fs.existsSync('/run/secrets/dropbox_appKey') && config.handleDockerSecret('dropbox_appKey')) || process.env.HMD_DROPBOX_APP_KEY || (configJson.dropbox && configJson.dropbox.appKey) || '' var data = { domain: config.domain, urlpath: config.urlpath, debug: config.debug, version: config.version, - GOOGLE_API_KEY: config.google ? config.google.GOOGLE_API_KEY : '', - GOOGLE_CLIENT_ID: config.google ? config.google.GOOGLE_CLIENT_ID : '', - DROPBOX_APP_KEY: config.dropbox ? config.dropbox.DROPBOX_APP_KEY : '' + GOOGLE_API_KEY: googleApiKey, + GOOGLE_CLIENT_ID: googleClientID, + DROPBOX_APP_KEY: dropboxAppKey } ejs.renderFile(constpath, data, {}, function (err, str) { if (err) throw new Error(err) |