Handles multiple application names in CredhubEnvironmentRepository#2447
Handles multiple application names in CredhubEnvironmentRepository#2447ryanjbaxter merged 2 commits intospring-cloud:4.1.xfrom
Conversation
|
Thanks! Could you submit this against the 4.1.x branch and we can merge it forward? @spencergibb what do you think about this change?
That could be considered breaking, so I am not sure we want to make that change in 4.1.x. I guess we could do it in main. |
Signed-off-by: kvmw <[email protected]>
Signed-off-by: kvmw <[email protected]>
The second commit adds the main PropertySource, even if it is empty. The only caveat is the name of the PropertySource, in case application has more than one name. For example, given |
|
Why change the property source name? |
PropertySource name has the following format: |
|
Is this how other EnvironmentRepositories handle this situation as well? |
|
If you mean splitting the application name, yes. In other repos application name is converted to an array and each individual item in array makes a separate property source. If you are referring to empty property sources, no. not all of them. For example, Vault does not create empty property source. |
|
Yes I was referring to the name, I just want to be as consistent as possible. |
JGit behaves the same. a sample config like this: spring:
profiles:
active: development,production
application:
name: cook,chefwill have the following property sources : |
The PR updates
CredhubEnvironmentRepositoryto handle following cases:application name can be a comma separated string like
foo,bar,baz. In this case, It should be spilted and each entry should be treated as app name. So the repository should search forfoo/profile/label,bar/profile/label,baz/profile/labeland finallyapplication/profile/label. This was handled in other repositories like JGit or Valut but not in CredHub.If the default application name (
application) is included in that comma separated string (like for example:foo,application,bar) it should be removed and added back to the end of the list. To make sure the default property source is added to the end of the list. Again other repositories are taking care of this but not CredHub.same for default profile (
default). If it's included in the profile string (profile1,default,profile2), It should be removed and added back to the end of the list. Again other repositories are taking care of this but not CredHub.Also, In current implementation, If there are no secrets at all in CredHub an empty
PropertySourcewill be added to the environment (envrionment.propertySourceswill have onePropertySourcewhich has no properties) . But this PR skips that andenvrionment.propertySourceswill be empty. If this is not desired, I can add that emptyProperySourceback.