Skip to content
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

Support read CREDENTIAL_ENV_VAR from VM option. #470

Open
haber-he opened this issue Aug 28, 2020 · 4 comments
Open

Support read CREDENTIAL_ENV_VAR from VM option. #470

haber-he opened this issue Aug 28, 2020 · 4 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@haber-he
Copy link

haber-he commented Aug 28, 2020

Hi team,

Can we support read CREDENTIAL_ENV_VAR from VM options?

Code snippet

 String credentialsPath = this.getProperty(CREDENTIAL_ENV_VAR, this.getEnv(CREDENTIAL_ENV_VAR));
@haber-he haber-he changed the title Support read credentials path from VM options Support read CREDENTIAL_ENV_VAR from VM option. Aug 28, 2020
@elharo
Copy link
Contributor

elharo commented Aug 29, 2020

Can you elaborate on this? What problem does this solve? Why this choice of variable name? Thanks.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Aug 29, 2020
@haber-he
Copy link
Author

haber-he commented Sep 1, 2020

I'm trying to integrate the Google reCAPTCHA in the AWS Elastic Beanstalk environment Tomcat & Java application, but Google required one system environment variable for the default credentials, something like this: System.getenv("GOOGLE_APPLICATION_CREDENTIALS"), but looks like AWS ElasticBeanstalkEnvironment only supports the VM options. that's simple and easy if google can read CREDENTIAL_ENV_VAR from VM options, otherwise, I have to write few extra codes to read the credentials from VM options.

GoogleCredentials credentials = GoogleCredentials.fromStream(new FileInputStream(System.getProperty("GOOGLE_APPLICATION_CREDENTIALS", System.getenv("GOOGLE_APPLICATION_CREDENTIALS"))));
RecaptchaEnterpriseServiceSettings serviceSettings = RecaptchaEnterpriseServiceSettings.newBuilder()
    .setCredentialsProvider(FixedCredentialsProvider.create(credentials)).build();
try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create(serviceSettings)) {
    xxxx
}

instead of expect one:

try (RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.create()) {
    xxx
}

@haber-he
Copy link
Author

haber-he commented Sep 1, 2020

so, is it that make sense to read the variable from VM options first and the system as the default? such as

 String credentialsPath = this.getProperty(CREDENTIAL_ENV_VAR, this.getEnv(CREDENTIAL_ENV_VAR));

@chingor13
Copy link
Contributor

cc @lsirac Will the upcoming 3pi credentials work better for this use case?

@chingor13 chingor13 added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Sep 2, 2020
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants