Skip to content

Commit

Permalink
Added trailing slash to parameter store examples (#1086)
Browse files Browse the repository at this point in the history
The trailing slash is required to avoid a leading dot in the property name. For example, if the parameter is named `/config/spring/message` and the `spring.config.import` property is `aws-parameterstore:/config/spring`, then the resulting property in the Spring environment will be `.message`. Instead, the property should be `message`, so the `spring.config.import` property should be `aws-parameterstore:/config/spring/`

Fixes #1058

Co-authored-by: Nathan Clement <nclement@qvalent.com>
  • Loading branch information
thelateperseus and Nathan Clement authored Mar 10, 2024
1 parent 5ff6f7c commit 165de38
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/src/main/asciidoc/parameter-store.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Maven coordinates, using <<index.adoc#bill-of-materials, Spring Cloud AWS BOM>>:

To fetch parameters from Parameter Store and add them to Spring's environment properties, add `spring.config.import` property to `application.properties`:

For example, assuming that the parameters in Parameter Store are stored under path `/config/spring`:
For example, assuming that the parameters in Parameter Store are stored under path `/config/spring/`:

|===
| Parameter Name | Parameter Value
Expand All @@ -31,7 +31,7 @@ Once `spring.config.import` statement is added:

[source,properties]
----
spring.config.import=aws-parameterstore:/config/spring
spring.config.import=aws-parameterstore:/config/spring/
----

Two parameters are added to environment: `message` and `httpUrl`.
Expand All @@ -40,21 +40,21 @@ If a given path in Parameter Store does not exist, application will fail to star

[source,properties]
----
spring.config.import=optional:aws-parameterstore:/config/spring
spring.config.import=optional:aws-parameterstore:/config/spring/
----

To load parameters from multiple paths, separate their names with `;`:

[source,properties]
----
spring.config.import=aws-parameterstore:/config/spring;/config/app
spring.config.import=aws-parameterstore:/config/spring/;/config/app/
----

If some parameters are required, and other ones are optional, list them as separate entries in `spring.config.import` property:

[source,properties]
----
spring.config.import[0]=optional:aws-parameterstore=/config/spring
spring.config.import[0]=optional:aws-parameterstore=/config/spring/
spring.config.import[1]=aws-parameterstore=/config/optional-params/
----

Expand All @@ -65,7 +65,7 @@ these will become accessible as array properties `cloud.aws.stack[0].name`, `clo

To avoid property key collisions it is possible to configure a property key prefix that gets added to each resolved parameter.

As an example, assuming the following parameters are stored under path `/config/my-datasource`:
As an example, assuming the following parameters are stored under path `/config/my-datasource/`:

|===
| Parameter Name | Parameter Value
Expand Down

0 comments on commit 165de38

Please sign in to comment.