Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomarquezp committed Jan 7, 2025
1 parent 0e2b5d6 commit 83d6d02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ management.endpoints.web.exposure.include=refresh
# Here we enable the config loader for GCP Secret Manager
# The sm:// syntax has been Deprecated and may be removed in a future version of
# Spring Cloud GCP. Please use the sm@ syntax instead.
spring.config.import=sm://
#spring.config.import=sm@
#spring.config.import=sm://
spring.config.import=sm@
application.secret=${sm@application-secret}
# enable default secret value when accessing non-exited secret.
spring.cloud.gcp.secretmanager.allow-default-secret=true
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,5 @@ void testApplicationStartupSecretLoadsCorrectly() {
"<b>Application secret from @ConfigurationProperties:</b> <i>"
+ SECRET_CONTENT
+ "</i>");
System.out.println(response.getBody());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@ static SecretVersionName getSecretVersionName(
String version = "latest";

if (tokens.length == 1) {
// property is form "sm@<secret-id>"
// property is of the form "sm@<secret-id>"
secretId = tokens[0];
} else if (tokens.length == 2) {
// property is form "sm@<secret-id>/<version>"
// property is of the form "sm@<secret-id>/<version>"
secretId = tokens[0];
version = tokens[1];
} else if (tokens.length == 3) {
// property is form "sm@<project-id>/<secret-id>/<version-id>"
// property is of the form "sm@<project-id>/<secret-id>/<version-id>"
projectId = tokens[0];
secretId = tokens[1];
version = tokens[2];
} else if (tokens.length == 4 && tokens[0].equals("projects") && tokens[2].equals("secrets")) {
// property is form "sm@projects/<project-id>/secrets/<secret-id>"
// property is of the form "sm@projects/<project-id>/secrets/<secret-id>"
projectId = tokens[1];
secretId = tokens[3];
} else if (tokens.length == 6
&& tokens[0].equals("projects")
&& tokens[2].equals("secrets")
&& tokens[4].equals("versions")) {
// property is form "sm@projects/<project-id>/secrets/<secret-id>/versions/<version>"
// property is of the form "sm@projects/<project-id>/secrets/<secret-id>/versions/<version>"
projectId = tokens[1];
secretId = tokens[3];
version = tokens[5];
Expand Down

0 comments on commit 83d6d02

Please sign in to comment.