Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f97ecaa

Browse filesBrowse files
gguussJon Wayne Parrott
authored andcommitted
Gets API key, project ID, and service account JSON from environment (GoogleCloudPlatform#1064)
1 parent 0b6e97d commit f97ecaa
Copy full SHA for f97ecaa

File tree

Expand file treeCollapse file tree

1 file changed

+10
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-4
lines changed

‎iot/api-client/manager/manager.py

Copy file name to clipboardExpand all lines: iot/api-client/manager/manager.py
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import argparse
3535
import io
36+
import os
3637
import sys
3738
import time
3839

@@ -344,16 +345,21 @@ def parse_command_line_args():
344345
formatter_class=argparse.RawDescriptionHelpFormatter)
345346

346347
# Required arguments
347-
parser.add_argument(
348-
'--project_id', required=True, help='GCP cloud project name.')
349348
parser.add_argument(
350349
'--pubsub_topic',
351350
required=True,
352351
help=('Google Cloud Pub/Sub topic. '
353352
'Format is projects/project_id/topics/topic-id'))
354-
parser.add_argument('--api_key', required=True, help='Your API key.')
355353

356354
# Optional arguments
355+
parser.add_argument(
356+
'--api_key',
357+
default=os.environ.get("API_KEY"),
358+
help='Your API key.')
359+
parser.add_argument(
360+
'--project_id',
361+
default=os.environ.get("GOOGLE_CLOUD_PROJECT"),
362+
help='GCP cloud project name.')
357363
parser.add_argument(
358364
'--ec_public_key_file',
359365
default=None,
@@ -366,7 +372,7 @@ def parse_command_line_args():
366372
'--cloud_region', default='us-central1', help='GCP cloud region')
367373
parser.add_argument(
368374
'--service_account_json',
369-
default='service_account.json',
375+
default=os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"),
370376
help='Path to service account json file.')
371377
parser.add_argument(
372378
'--registry_id',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.