-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide different credentials when running in cloud
- Loading branch information
Brian Butz
committed
Dec 9, 2019
1 parent
4d6a3f5
commit 713bf75
Showing
3 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const services = { | ||
get NASA_API_KEY() { | ||
const credentials = getVCAPServices()['credhub'][0]['credentials']; | ||
return credentials['NASA_API_KEY']; | ||
}, | ||
|
||
get REDIS_OPTIONS() { | ||
const redisCredentials = getVCAPServices()['p.redis'][0]["credentials"]; | ||
|
||
const host = redisCredentials["host"]; | ||
const port = redisCredentials["port"]; | ||
const password = redisCredentials["password"]; | ||
|
||
return { | ||
host, | ||
port, | ||
password | ||
} | ||
} | ||
}; | ||
|
||
function getVCAPServices() { | ||
return JSON.parse(process.env.VCAP_SERVICES); | ||
} | ||
|
||
module.exports = services; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const services = { | ||
get NASA_API_KEY() { | ||
return process.env.NASA_API_KEY; | ||
}, | ||
|
||
get REDIS_OPTIONS() { | ||
const host = '127.0.0.1'; | ||
const port = 6379; | ||
|
||
return { | ||
host, | ||
port | ||
} | ||
} | ||
}; | ||
|
||
module.exports = services; |