Skip to content

Commit

Permalink
build: use bit.ly credentials from env keys, if present
Browse files Browse the repository at this point in the history
  • Loading branch information
amoncaldas committed Dec 1, 2021
1 parent 2e1fec0 commit 5589dd0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/prod.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
const packageJson = require('../package.json')

let ORSKEY = process.env.ORSKEY
let BITLYLOGIN = process.env.BITLYLOGIN
let BITLYAPIKEY = process.env.BITLYAPIKEY

let env = {
NODE_ENV: '"production"',
Expand All @@ -12,5 +14,11 @@ let env = {
if (ORSKEY) {
env.ORSKEY = `"${ORSKEY}"`
}
if (BITLYLOGIN) {
env.BITLYLOGIN = `"${BITLYLOGIN}"`
}
if (BITLYAPIKEY) {
env.BITLYAPIKEY = `"${BITLYAPIKEY}"`
}

module.exports = env
13 changes: 12 additions & 1 deletion src/app-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ class AppLoader {
if (store.getters.dataAcquired) {
resolve(store.getters.mapSettings.apiKey)
} else {
// eslint-disable-next-line no-undef
var BITLYLOGIN = process.env.BITLYLOGIN
// eslint-disable-next-line no-undef
var BITLYAPIKEY = process.env.BITLYAPIKEY
if (BITLYLOGIN) {
appConfig.bitlyLogin = BITLYLOGIN
}
if (BITLYAPIKEY) {
appConfig.bitlyApiKey = BITLYAPIKEY
}

// For some reason not yet identified (maybe a vue router bug?)
// the `beforeEnter` guard used to fire this action is being called
// multiple times. so, we had to implement this `apiDataRequested` flag
Expand All @@ -37,7 +48,7 @@ class AppLoader {
store.commit('apiDataRequested', true)

// eslint-disable-next-line no-undef
var ORSKEY = process.env.ORSKEY
var ORSKEY = process.env.ORSKEY

// By default, the app must use an ors API key stored in config.js
if (appConfig.useUserKey) {
Expand Down

0 comments on commit 5589dd0

Please sign in to comment.