How to set GOOGLE_APPLICATION_CREDENTIALS for Google Compute Engine?

前端 未结 3 780
难免孤独
难免孤独 2021-01-18 00:31

I have Google Compute Engine\'s Credentials file , renamed as key.json. The next step is to set the environment variable with name GOOGLE_APPLICATION_CREDENTIALS. But it say

3条回答
  •  难免孤独
    2021-01-18 01:01

    If you are using a tomcat (although this is valid in any case), you have to search for "launch configuration", in the "environment" tab you can add the variable and its value. In the image you can see that I accessed "launch configuration" from the tomcat overview.

    Another option is to use GoogleCredentials.fromStream ("path_to_json") to set the credentials, depending on which api is used where it can be used.

提交回复
热议问题