Add support for configuring a GoogleAdsClient using environment variables#386
Add support for configuring a GoogleAdsClient using environment variables#386
Conversation
…iables Also added support for configuring `linkedCustomerId` from a config file, properties, or an environment variable.
|
Note to reviewers: I considered multiple approaches here, but having a private
|
|
Heads up @nwbirnie and @devchas : I was able to find a way to implement "last one wins" logic for the 3rd requirement:
With the latest commit, users who previously took the following steps in either order will see the same behavior as always:
That is, the last step they performed will configure their credentials. My prior commits on this PR would have made either sequence throw an exception, which would have been a breaking change. |
nwbirnie
left a comment
There was a problem hiding this comment.
First round of comments - going to take another pass just now
|
|
||
| @VisibleForTesting | ||
| Builder setEnvironment(Map<String, String> environment) { | ||
| this.environment = ImmutableMap.copyOf(environment); |
There was a problem hiding this comment.
Why do we need state to represent the environment? Can't we just load the environment as required?
It looks like you could use a Supplier<Map<String,String>> to represent abstract this for testing purposes.
There was a problem hiding this comment.
Good suggestion. I swapped this out with a Function<String, String> and it worked out quite nicely + avoided copying the environment map.
|
LGTM pending open comments |
|
I merged from master at |
Also added support for configuring
linkedCustomerIdfrom a configfile, properties, or an environment variable.