Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit f6100dd

Browse files
Add logging to AWSParameterStorePropertySource.
Closes gh-529 Fixes gh-509 Fixes gh-527 Co-authored-by: Maciej Walkowiak <[email protected]>
1 parent 159200b commit f6100dd

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

docs/src/main/asciidoc/_configprops.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
|===
22
|Name | Default | Description
33

4-
|aws.paramstore.default-context | application |
4+
|aws.paramstore.default-context | application |
55
|aws.paramstore.enabled | true | Is AWS Parameter Store support enabled.
66
|aws.paramstore.fail-fast | true | Throw exceptions during config lookup if true, otherwise, log warnings.
77
|aws.paramstore.name | | Alternative to spring.application.name to use in looking up values in AWS Parameter Store.
88
|aws.paramstore.prefix | /config | Prefix indicating first level for every property. Value must start with a forward slash followed by a valid path segment or be empty. Defaults to "/config".
9-
|aws.paramstore.profile-separator | _ |
10-
|aws.secretsmanager.default-context | application |
9+
|aws.paramstore.profile-separator | _ |
10+
|aws.secretsmanager.default-context | application |
1111
|aws.secretsmanager.enabled | true | Is AWS Secrets Manager support enabled.
1212
|aws.secretsmanager.fail-fast | true | Throw exceptions during config lookup if true, otherwise, log warnings.
1313
|aws.secretsmanager.name | | Alternative to spring.application.name to use in looking up values in AWS Secrets Manager.
1414
|aws.secretsmanager.prefix | /secret | Prefix indicating first level for every property. Value must start with a forward slash followed by a valid path segment or be empty. Defaults to "/config".
15-
|aws.secretsmanager.profile-separator | _ |
15+
|aws.secretsmanager.profile-separator | _ |
1616
|cloud.aws.credentials.access-key | | The access key to be used with a static provider.
1717
|cloud.aws.credentials.instance-profile | true | Configures an instance profile credentials provider with no further configuration.
1818
|cloud.aws.credentials.profile-name | | The AWS profile name.
@@ -23,8 +23,8 @@
2323
|cloud.aws.loader.max-pool-size | | The maximum pool size of the Task Executor used for parallel S3 interaction. @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setMaxPoolSize(int)
2424
|cloud.aws.loader.queue-capacity | | The maximum queue capacity for backed up S3 requests. @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor#setQueueCapacity(int)
2525
|cloud.aws.region.auto | true | Enables automatic region detection based on the EC2 meta data service.
26-
|cloud.aws.region.use-default-aws-region-chain | false | Use the DefaultAwsRegion Chain instead of configuring a custom region provider chain.
27-
|cloud.aws.region.static | |
26+
|cloud.aws.region.static | |
27+
|cloud.aws.region.use-default-aws-region-chain | false | Whether default AWS SDK region provider chain should be used when auto is set to true.
2828
|cloud.aws.stack.auto | true | Enables the automatic stack name detection for the application.
2929
|cloud.aws.stack.name | myStackName | The name of the manually configured stack name that will be used to retrieve the resources.
3030

docs/src/main/asciidoc/spring-cloud-aws.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,17 @@ You can configure the following settings in a Spring Cloud `bootstrap.properties
664664
|Can be used to disable the Parameter Store Configuration support even though the auto-configuration is on the classpath.
665665
|===
666666

667+
[TIP]
668+
====
669+
In order to find out which properties are retrieved from AWS Parameter Store on application startup,
670+
turn on `DEBUG` logging on `org.springframework.cloud.aws.paramstore.AwsParamStorePropertySource` class.
671+
672+
[source,indent=0]
673+
----
674+
logging.level.org.springframework.cloud.aws.paramstore.AwsParamStorePropertySource=debug
675+
----
676+
====
677+
667678
=== Integrating your Spring Cloud application with the AWS Secrets Manager
668679

669680
Spring Cloud provides support for centralized configuration, which can be read and made available as a regular Spring

spring-cloud-aws-parameter-store-config/src/main/java/org/springframework/cloud/aws/paramstore/AwsParamStorePropertySource.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import com.amazonaws.services.simplesystemsmanagement.model.GetParametersByPathRequest;
2525
import com.amazonaws.services.simplesystemsmanagement.model.GetParametersByPathResult;
2626
import com.amazonaws.services.simplesystemsmanagement.model.Parameter;
27+
import org.slf4j.Logger;
28+
import org.slf4j.LoggerFactory;
2729

2830
import org.springframework.core.env.EnumerablePropertySource;
2931

@@ -37,6 +39,9 @@
3739
public class AwsParamStorePropertySource
3840
extends EnumerablePropertySource<AWSSimpleSystemsManagement> {
3941

42+
private static final Logger LOGGER = LoggerFactory
43+
.getLogger(AwsParamStorePropertySource.class);
44+
4045
private String context;
4146

4247
private Map<String, Object> properties = new LinkedHashMap<>();
@@ -69,6 +74,8 @@ private void getParameters(GetParametersByPathRequest paramsRequest) {
6974
.getParametersByPath(paramsRequest);
7075
for (Parameter parameter : paramsResult.getParameters()) {
7176
String key = parameter.getName().replace(context, "").replace('/', '.');
77+
LOGGER.debug("Populating property retrieved from AWS Parameter Store: {}",
78+
key);
7279
properties.put(key, parameter.getValue());
7380
}
7481
if (paramsResult.getNextToken() != null) {

0 commit comments

Comments
 (0)