Ordered Support for awssecretsmanager profile. Fixes gm-1980 (#1981)
* Ordered Support for awssecretsmanager profile. Fixes gm-1980 * Ordered Support for GoogleSecretManager profile. Fixes gm-1980 Co-authored-by: knv <srinivaskatta@freo.money>
This commit is contained in:
@@ -33,14 +33,16 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.cloud.config.environment.Environment;
|
||||
import org.springframework.cloud.config.environment.PropertySource;
|
||||
import org.springframework.cloud.config.server.config.ConfigServerProperties;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.springframework.cloud.config.server.environment.AwsSecretsManagerEnvironmentProperties.DEFAULT_PATH_SEPARATOR;
|
||||
|
||||
/**
|
||||
* @author Tejas Pandilwar
|
||||
* @author KNV Srinivas
|
||||
*/
|
||||
public class AwsSecretsManagerEnvironmentRepository implements EnvironmentRepository {
|
||||
public class AwsSecretsManagerEnvironmentRepository implements EnvironmentRepository, Ordered {
|
||||
|
||||
private static final Log log = LogFactory.getLog(AwsSecretsManagerEnvironmentRepository.class);
|
||||
|
||||
@@ -52,12 +54,15 @@ public class AwsSecretsManagerEnvironmentRepository implements EnvironmentReposi
|
||||
|
||||
private final AwsSecretsManagerEnvironmentProperties environmentProperties;
|
||||
|
||||
private final int order;
|
||||
|
||||
public AwsSecretsManagerEnvironmentRepository(AWSSecretsManager awsSmClient,
|
||||
ConfigServerProperties configServerProperties,
|
||||
AwsSecretsManagerEnvironmentProperties environmentProperties) {
|
||||
this.awsSmClient = awsSmClient;
|
||||
this.configServerProperties = configServerProperties;
|
||||
this.environmentProperties = environmentProperties;
|
||||
this.order = environmentProperties.getOrder();
|
||||
this.objectMapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@@ -153,4 +158,9 @@ public class AwsSecretsManagerEnvironmentRepository implements EnvironmentReposi
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,12 +32,14 @@ import org.springframework.cloud.config.server.environment.secretmanager.GoogleS
|
||||
import org.springframework.cloud.config.server.environment.secretmanager.GoogleSecretManagerAccessStrategy;
|
||||
import org.springframework.cloud.config.server.environment.secretmanager.GoogleSecretManagerAccessStrategyFactory;
|
||||
import org.springframework.cloud.config.server.environment.secretmanager.HttpHeaderGoogleConfigProvider;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* @author Jose Maria Alvarez
|
||||
* @author KNV Srinivas
|
||||
*/
|
||||
public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepository {
|
||||
public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepository, Ordered {
|
||||
|
||||
private String applicationLabel;
|
||||
|
||||
@@ -49,6 +51,8 @@ public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepo
|
||||
|
||||
private GoogleConfigProvider configProvider;
|
||||
|
||||
private final int order;
|
||||
|
||||
public GoogleSecretManagerEnvironmentRepository(ObjectProvider<HttpServletRequest> request, RestTemplate rest,
|
||||
GoogleSecretManagerEnvironmentProperties properties) {
|
||||
this.applicationLabel = properties.getApplicationLabel();
|
||||
@@ -56,6 +60,7 @@ public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepo
|
||||
this.configProvider = new HttpHeaderGoogleConfigProvider(request);
|
||||
this.accessStrategy = GoogleSecretManagerAccessStrategyFactory.forVersion(rest, configProvider, properties);
|
||||
this.tokenMandatory = properties.getTokenMandatory();
|
||||
this.order = properties.getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,4 +119,8 @@ public class GoogleSecretManagerEnvironmentRepository implements EnvironmentRepo
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user