mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Merged feature/qrun-support-20250313 into integration
This commit is contained in:
@ -72,6 +72,18 @@ public class SecretsManagerUtils
|
|||||||
** and write them to a .env file (backing up any pre-existing .env files first).
|
** and write them to a .env file (backing up any pre-existing .env files first).
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public static void writeEnvFromSecretsWithNamePrefix(String prefix) throws IOException
|
public static void writeEnvFromSecretsWithNamePrefix(String prefix) throws IOException
|
||||||
|
{
|
||||||
|
writeEnvFromSecretsWithNamePrefix(prefix, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** IF secret manager ENV vars are set,
|
||||||
|
** THEN lookup all secrets starting with the given prefix,
|
||||||
|
** and write them to a .env file (backing up any pre-existing .env files first).
|
||||||
|
*******************************************************************************/
|
||||||
|
public static void writeEnvFromSecretsWithNamePrefix(String prefix, boolean quoteValues) throws IOException
|
||||||
{
|
{
|
||||||
Optional<AWSSecretsManager> optionalSecretsManagerClient = getSecretsManagerClient();
|
Optional<AWSSecretsManager> optionalSecretsManagerClient = getSecretsManagerClient();
|
||||||
if(optionalSecretsManagerClient.isPresent())
|
if(optionalSecretsManagerClient.isPresent())
|
||||||
@ -91,7 +103,9 @@ public class SecretsManagerUtils
|
|||||||
Optional<String> secretValue = getSecret(prefix, nameWithoutPrefix);
|
Optional<String> secretValue = getSecret(prefix, nameWithoutPrefix);
|
||||||
if(secretValue.isPresent())
|
if(secretValue.isPresent())
|
||||||
{
|
{
|
||||||
String envLine = nameWithoutPrefix + "=" + secretValue.get();
|
String envLine = quoteValues
|
||||||
|
? nameWithoutPrefix + "=\"" + secretValue.get() + "\""
|
||||||
|
: nameWithoutPrefix + "=" + secretValue.get();
|
||||||
fullEnv.append(envLine).append('\n');
|
fullEnv.append(envLine).append('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user