Class SecretsManagerUtils
java.lang.Object
com.kingsrook.qqq.backend.core.instances.SecretsManagerUtils
Utility class for working with AWS Secrets Manager.
Relies on environment variables:
SECRETS_MANAGER_ACCESS_KEY
SECRETS_MANAGER_SECRET_KEY
SECRETS_MANAGER_REGION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a single secret value.static void
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).static void
writeEnvFromSecretsWithNamePrefix
(String prefix, boolean quoteValues) 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).static void
writeSecret
(String path, String name, String value) Tries to do a Create - if that fails, then does a Put (update).
-
Constructor Details
-
SecretsManagerUtils
public SecretsManagerUtils()
-
-
Method Details
-
writeEnvFromSecretsWithNamePrefix
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).- Throws:
IOException
-
writeEnvFromSecretsWithNamePrefix
public static void writeEnvFromSecretsWithNamePrefix(String prefix, boolean quoteValues) throws IOException 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).- Throws:
IOException
-
getSecret
Get a single secret value. The lookup in secrets manager is done by (path + name). Then, in the value that comes back, if it looks like JSON, we look for a value inside it under the key of just "name". Else, if we didn't get JSON back, then we just return the full text value of the secret. -
writeSecret
-