quarkus-google-cloud-services
quarkus-google-cloud-services copied to clipboard
Secret Manager does not work with `@ConfigMapping`
Having an application.properties file with:
%prod.my.username=${sm//MY_USERNAME}
Injecting it with @ConfigProperty it works:
@ApplicationScoped
public class MyHeadersFactory implements ClientHeadersFactory {
@ConfigProperty(name = "my.username")
Optional<String> username;
..
but using a @ConfigMapping like:
@ConfigMapping(prefix = "my")
public interface MyProperties {
Optional<String> username();
}
@ApplicationScoped
public class MyHeadersFactory implements ClientHeadersFactory {
@Inject
MyProperties myProperties;
..
will cause the application not to be started in GCP environment.
The error is somewhat vague on GCP...:
[pid1-app] Exit 1 app (pid 12): /bin/sh -c exec serve /workspace/build/my-1.0.0-SNAPSHOT-runner.jar [session:HVT03PV]
[pid1] A process stopped unexpectedly: <nil> [session:HVT03PV]
Could it be that with @ConfigMapping it tries to "read" the properties to early?
And with @ConfigProperty is more of lazy load?
I'm wondering as I used Spring GCP before and for Secret Manager they have a special bootstrap.properties files and bootstrap property source: https://googlecloudplatform.github.io/spring-cloud-gcp/3.3.0/reference/html/index.html#secret-manager-property-source
For now I will just use @ConfigProperty(name = "my.username") as that works.
Hi, Thanks for reporting, can you provide a small reproducer project ?
And also confirm it work on dev mode and only fail on GCP. By the way, how do you launch it on GCP ? Which service is use to run it ?
Hi,
It fails on Google AppEngine Standard.
The application is uploaded using glcoud app deploy so the actual build is done using Google Cloud Build.
Locally I have no Google Secret Manager so not sure if I can try this in dev mode.
OK, a small reproducer would be great.
OK will do that after holidays... I've no access to dev laptop :-D
@marceloverdijk did you had the time to creat a small reproducer ?
I'm sorry Loic, I never did that. Don't have project currently that I can use for this. Probably better to close this issue, and re-open later if needed.
OK, thanks for the feedback