All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.com.bancolombia.secretsmanager.connector.EnvConnector Maven / Gradle / Ivy

package co.com.bancolombia.secretsmanager.connector;

import co.com.bancolombia.secretsmanager.api.GenericManager;
import co.com.bancolombia.secretsmanager.api.exceptions.SecretException;

/**
 * Represents an Environment Connector. It lets you to get secrets in
 * environment variables.
 *
 * @author Andrés Mauricio Gómez
 * P.
 */
public class EnvConnector implements GenericManager {

    @Override
    public String getSecret(String secretName) throws SecretException {
        String myEnv = System.getenv(secretName);
        if (myEnv == null) {
            throw new SecretException("The requested secret " + secretName + " was not found");
        } else {
            return myEnv;
        }
    }

    @Override
    public  T getSecret(String secretName, Class cls){
        throw new UnsupportedOperationException("Serialization doesn't apply for env connector");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy