Skip to content

Commit 5d764a2

Browse files
authored
Adding environment variables for project, instance, and database options (#17)
1 parent 52ef72b commit 5d764a2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ which should be stable and much faster.
2727

2828
## Limitations
2929

30-
- This tool does not ensure consistency between database schema (DDL) and data. So you should avoid making changes to the schema while you are running this tool.
30+
- This tool does not ensure consistency between database schema (DDL) and data. So you should avoid making changes to the schema while you are running this tool.
3131
- This tool does not consider data order constrained by [Foreign Keys](https://cloud.google.com/spanner/docs/foreign-keys/overview).
3232

3333
## Install
@@ -43,9 +43,9 @@ Usage:
4343
spanner-dump [OPTIONS]
4444
4545
Application Options:
46-
-p, --project= (required) GCP Project ID.
47-
-i, --instance= (required) Cloud Spanner Instance ID.
48-
-d, --database= (required) Cloud Spanner Database ID.
46+
-p, --project= (required) GCP Project ID. [$SPANNER_PROJECT_ID]
47+
-i, --instance= (required) Cloud Spanner Instance ID. [$SPANNER_INSTANCE_ID]
48+
-d, --database= (required) Cloud Spanner Database ID. [$SPANNER_DATABASE_ID]
4949
--tables= comma-separated table names, e.g. "table1,table2"
5050
--no-ddl No DDL information.
5151
--no-data Do not dump data.

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ import (
2828
)
2929

3030
type options struct {
31-
ProjectId string `short:"p" long:"project" description:"(required) GCP Project ID."`
32-
InstanceId string `short:"i" long:"instance" description:"(required) Cloud Spanner Instance ID."`
33-
DatabaseId string `short:"d" long:"database" description:"(required) Cloud Spanner Database ID."`
31+
ProjectId string `short:"p" long:"project" env:"SPANNER_PROJECT_ID" description:"(required) GCP Project ID."`
32+
InstanceId string `short:"i" long:"instance" env:"SPANNER_INSTANCE_ID" description:"(required) Cloud Spanner Instance ID."`
33+
DatabaseId string `short:"d" long:"database" env:"SPANNER_DATABASE_ID" description:"(required) Cloud Spanner Database ID."`
3434
Tables string `long:"tables" description:"comma-separated table names, e.g. \"table1,table2\" "`
3535
NoDDL bool `long:"no-ddl" description:"No DDL information."`
3636
NoData bool `long:"no-data" description:"Do not dump data."`

0 commit comments

Comments
 (0)