-
-
Notifications
You must be signed in to change notification settings - Fork 793
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Resolve Fn::Join in environment variables
- Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion.
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,19 @@ | ||
// Used to resolve Fn::Join in environment variables | ||
export default function resolveJoins(environment) { | ||
const newEnv = {}; | ||
|
||
Object.keys(environment).forEach((key) => { | ||
const value = environment[key]; | ||
const joinArray = value['Fn::Join']; | ||
const isJoin = Boolean(joinArray); | ||
|
||
if (isJoin) { | ||
const separator = joinArray[0]; | ||
const joined = joinArray[1].join(separator); | ||
return newEnv[key] = joined; | ||
} | ||
newEnv[key] = value; | ||
}) | ||
|
||
return newEnv; | ||
} |