-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Secrets support in Orchestra * CLI secrets support * Secrets -> Env * Renaming methods and adding escape character
- Loading branch information
1 parent
6979d5c
commit 5c8d794
Showing
9 changed files
with
220 additions
and
33 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
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
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
20 changes: 20 additions & 0 deletions
20
maestro-orchestra-models/src/main/java/maestro/orchestra/util/Env.kt
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,20 @@ | ||
package maestro.orchestra.util | ||
|
||
object Env { | ||
|
||
fun String.injectEnv(env: Map<String, String>): String { | ||
if (env.isEmpty()) { | ||
return this | ||
} | ||
|
||
return env | ||
.entries | ||
.fold(this) { acc, (key, value) -> | ||
acc.replace("(?<!\\\\)\\$\\{$key}".toRegex(), value) | ||
} | ||
.replace("\\\\\\$\\{.*}".toRegex()) { match -> | ||
match.value.substringAfter('\\') | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.