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

com.infusers.core.secrets.SecretManagerConfig Maven / Gradle / Ivy

There is a newer version: 2024.12.0008
Show newest version
package com.infusers.core.secrets;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import com.infusers.core.logger.ILogger;
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 ILogger log = new ILogger(SecretManagerConfig.class);
	
//    private final SecretManager secretManager;
//
//    @Autowired
//    public SecretManagerConfig(SecretManager secretManager) {
//        this.secretManager = secretManager;
//    }	

    @Bean
    @Profile("aws")
    public SecretManager awsSecretManager() {
    	log.warnWithSeparator("SecretManagerConfig.awsSecretManager()--> Profile is AWS!");    	
    	return new AWSSecretManager();
    }

    @Bean
    @Profile("gcp")
    public SecretManager gcpSecretManager() {
		log.warnWithSeparator("SecretManagerConfig.gcpSecretManager()--> Profile is GCP!");
    	return new GCPSecretManager();
    }
    
    @Bean
    @Profile("az")
    public SecretManager azSecretManager() {
		log.warnWithSeparator("SecretManagerConfig.azSecretManager()--> Profile is Az!");
    	return new AzSecretManager();
    }    
    
    @Bean
    @Profile("!aws && !gcp && !az")
    public SecretManager defaultSecretManager() {
		log.warnWithSeparator("SecretManagerConfig.defaultSecretManager()--> Profile is Local/Laptop!");
    	return new DefaultSecretManager();
    }    
}    




© 2015 - 2025 Weber Informatics LLC | Privacy Policy