com.infusers.core.secrets.SecretManagerConfig Maven / Gradle / Ivy
package com.infusers.core.secrets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import com.infusers.core.secrets.aws.AWSSecretManager;
import com.infusers.core.secrets.az.AzSecretManager;
import com.infusers.core.secrets.gcp.GCPSecretManager;
import com.infusers.core.secrets.local.DefaultSecretManager;
@Configuration
public class SecretManagerConfig {
private Logger log = LogManager.getLogger(SecretManagerConfig.class);
@Bean
@Profile("aws")
public SecretManager awsSecretManager() {
log.info("=========================================================");
log.warn("SecretManagerConfig.awsSecretManager()--> Profile is AWS!");
log.info("=========================================================");
return new AWSSecretManager();
}
@Bean
@Profile("gcp")
public SecretManager gcpSecretManager() {
log.info("=========================================================");
log.warn("SecretManagerConfig.gcpSecretManager()--> Profile is GCP!");
log.info("=========================================================");
return new GCPSecretManager();
}
@Bean
@Profile("az")
public SecretManager azSecretManager() {
log.info("=========================================================");
log.warn("SecretManagerConfig.azSecretManager()--> Profile is Az!");
log.info("=========================================================");
return new AzSecretManager();
}
@Bean
@Profile("!aws && !gcp && !az")
public SecretManager defaultSecretManager() {
log.info("======================================================================");
log.warn("SecretManagerConfig.defaultSecretManager()--> Profile is Local/Laptop!");
log.info("======================================================================");
return new DefaultSecretManager();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy