-
Notifications
You must be signed in to change notification settings - Fork 6
Fix GoogleServiceConfiguration field names #2530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fixes a couple of issues: 1. We had non-idiomatic field names in `GoogleServiceConfiguration` 2. We were building JSON via toString() To fix this, we use standard Java naming in the config object (Micronaut handles the dash or underscore replacement from config) And we use `@JsonProperty` and Micronaut's `JsonMapper` to perform the serialization. Removed the test for getters/setters working and replaced with a test that verifies config can be loaded, and converted to a json string and parsed.
|
|
||
| @NotNull | ||
| public String directory_id; | ||
| @JsonProperty("directory_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure your plan for this PR after our discussion but, if you don't end up removing these completely, it's worth noting that you converted the _s to -s in the json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the yaml configuration I converted to use hyphens instead of underscores, but both will work for defining properties in Micronaut (but hyphen is more idiomatic)
In the generated JSON from this object, it will still use underscores (as the JsonProperty specifies underscores)
mkimberlin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to go ahead and approve this. It's a positive step regardless of whether you end up eventually taking the step of removing these in favor of the encoded version.
|
I'll convert this to Draft until I get round to the Base64 decoding and simplification we discussed... It's next on my list once I get Graal working |
rodecapd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with Tim, he's goiing to change the ENV variable name and I'll pick it up in the terraform work.
Before this PR;
GoogleServiceConfigurationWhen you create a service account with Google, they supply you with a JSON document which contains all the fields previously in
GoogleServiceConfiguration.Instead of requiring these to be copied out into separate fields for us to then re-create the JSON document on startup, this PR;
Warning
We will need to ensure that this
SERVICE_ACCOUNT_CREDENTIALSenvironment variable exists where we deploy to.I have no visibility of PROD or DEV environments, so cannot confirm this.
This environment variable needs to contain the Base64 encoded JSON document from google for the service account