File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 3333
3434import argparse
3535import io
36+ import os
3637import sys
3738import 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' ,
You can’t perform that action at this time.
0 commit comments