Skip to content

Commit 449b2b2

Browse files
committed
feat: allow specifying gcp project in cli
1 parent c84dfb4 commit 449b2b2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/commands/upload.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import * as yaml from 'js-yaml';
77
import {getGitData} from '../gitdata';
88

99
interface UploadOptions {
10+
branch?: string;
1011
bucket: string;
1112
force?: boolean;
12-
site: string;
13+
googleCloudProject?: string;
1314
ref?: string;
14-
branch?: string;
15+
site: string;
1516
ttl?: string;
1617
}
1718

@@ -60,10 +61,12 @@ export class UploadCommand {
6061
const site = this.options.site || config.site;
6162

6263
const googleCloudProject =
63-
config.google_cloud_project || process.env.GOOGLE_CLOUD_PROJECT;
64+
this.options.googleCloudProject ||
65+
config.google_cloud_project ||
66+
process.env.GOOGLE_CLOUD_PROJECT;
6467
if (!googleCloudProject) {
6568
throw new Error(
66-
'Unable to determine which Google Cloud Storage bucket to use. You must specify a `google_cloud_project` in `fileset.yaml` or specify a `GOOGLE_CLOUD_PROJECT` environment variable.'
69+
'Unable to determine which Google Cloud Storage bucket to use. You must specify a `google_cloud_project` in `fileset.yaml`, use the `-p` flag, or specify a `GOOGLE_CLOUD_PROJECT` environment variable.'
6770
);
6871
}
6972
const bucket = this.options.bucket || `${googleCloudProject}.appspot.com`;

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ async function main() {
1010
program
1111
.command('upload [dir]')
1212
.description('Uploads a directory to cloud storage')
13+
.option('-p, --google-cloud-project <project>', 'project', '')
1314
.option('-s, --site <site>', 'site', '')
1415
.option('-r, --ref <ref>', 'ref', '')
1516
.option('-b, --branch <branch>', 'branch', '')

0 commit comments

Comments
 (0)