forked from supabase/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset.command.ts
More file actions
46 lines (42 loc) · 1.68 KB
/
Copy pathset.command.ts
File metadata and controls
46 lines (42 loc) · 1.68 KB
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
42
43
44
45
46
import type * as CliCommand from "effect/unstable/cli/Command";
import { Argument, Command, Flag } from "effect/unstable/cli";
import { withJsonErrorHandling } from "../../../../shared/output/json-error-handling.ts";
import { legacyManagementApiRuntimeLayer } from "../../../shared/legacy-management-api-runtime.layer.ts";
import { withLegacyCommandInstrumentation } from "../../../telemetry/legacy-command-instrumentation.ts";
import { legacySecretsSet } from "./set.handler.ts";
const config = {
projectRef: Flag.string("project-ref").pipe(
Flag.withDescription("Project ref of the Supabase project."),
Flag.optional,
),
envFile: Flag.string("env-file").pipe(
Flag.withDescription("Read secrets from a .env file."),
Flag.optional,
),
secrets: Argument.string("NAME=VALUE").pipe(
Argument.withDescription("Secret name=value pairs to set."),
Argument.variadic(),
),
} as const;
export type LegacySecretsSetFlags = CliCommand.Command.Config.Infer<typeof config>;
export const legacySecretsSetCommand = Command.make("set", config).pipe(
Command.withDescription("Set a secret(s) to the linked Supabase project."),
Command.withShortDescription("Set a secret(s) on Supabase"),
Command.withExamples([
{
command: "supabase secrets set MY_SECRET=myvalue",
description: "Set a secret by name and value",
},
{
command: "supabase secrets set --env-file .env",
description: "Set secrets from a .env file",
},
]),
Command.withHandler((flags) =>
legacySecretsSet(flags).pipe(
withLegacyCommandInstrumentation({ flags }),
withJsonErrorHandling,
),
),
Command.provide(legacyManagementApiRuntimeLayer(["secrets", "set"])),
);