Skip to content

Commit

Permalink
Normalizing config options names (#155)
Browse files Browse the repository at this point in the history
If socket name is:
`test-123`
and it has config option:
`API-KEY`
CLI is going to look for:
`TEST_123__API_KEY` env variable and for
`TEST_123_API_KEY` (for backward compatibility)
  • Loading branch information
mkucharz authored Feb 16, 2018
1 parent 0134f64 commit c35a41a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/cli/src/utils/sockets/sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,10 @@ class Socket {
}

getConfigOptionFromEnv (optionName) {
return process.env[`${this.name.toUpperCase()}_${optionName.toUpperCase()}`]
const socketVarName = this.name.replace('-', '_').toUpperCase()
const optionVarName = optionName.replace('-', '_').toUpperCase()
return process.env[`${socketVarName}__${optionVarName}`] ||
process.env[`${socketVarName}_${optionVarName}`]
}

getConfigOptionsToAsk () {
Expand Down

0 comments on commit c35a41a

Please sign in to comment.