Package dev.enola.common.secret
Class EnvironmentSecretManager
java.lang.Object
dev.enola.common.secret.ReadOnlySecretManager
dev.enola.common.secret.EnvironmentSecretManager
- All Implemented Interfaces:
SecretManager
SecretManager that reads secrets from the value of named environment variables.
This is not secure at all, and other implementations are preferred - but sometimes this is still quite useful, unfortunately. It's generally a Bad Idea to use this in any application which "shells out" (exec) to any other process, when would then be able to see any such (not so) "secret" environment variables!
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetOptional(String key) Retrieves a secret by its key, with optionality.Methods inherited from class dev.enola.common.secret.ReadOnlySecretManager
delete, storeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.enola.common.secret.SecretManager
get
-
Constructor Details
-
EnvironmentSecretManager
public EnvironmentSecretManager()
-
-
Method Details
-
getOptional
Description copied from interface:SecretManagerRetrieves a secret by its key, with optionality.- Parameters:
key- The unique key (name) of the secret to retrieve.- Returns:
- An
Optionalcontaining theSecret, if found. - Throws:
IOException- If an error occurs while retrieving the secret.
-