/
apphosting-backends-create.ts
41 lines (39 loc) · 1.34 KB
/
apphosting-backends-create.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Command } from "../command";
import { Options } from "../options";
import { needProjectId } from "../projectUtils";
import requireInteractive from "../requireInteractive";
import { doSetup } from "../apphosting";
import { ensureApiEnabled } from "../gcp/apphosting";
export const command = new Command("apphosting:backends:create")
.description("create a Firebase App Hosting backend")
.option(
"-a, --app <webApp>",
"specify an existing Firebase web app to associate your App Hosting backend with",
)
.option("-l, --location <location>", "specify the location of the backend", "")
.option(
"-s, --service-account <serviceAccount>",
"specify the service account used to run the server",
"",
)
.option(
"-w, --with-dev-connect",
"use the Developer Connect flow instead of Cloud Build Repositories (testing)",
true,
)
.before(ensureApiEnabled)
.before(requireInteractive)
.action(async (options: Options) => {
const projectId = needProjectId(options);
const webApp = options.app;
const location = options.location;
const serviceAccount = options.serviceAccount;
const withDevConnect = options.withDevConnect as boolean;
await doSetup(
projectId,
webApp as string | null,
location as string | null,
serviceAccount as string | null,
withDevConnect,
);
});