Skip to content

Commit c73d042

Browse files
committed
env vars
1 parent 3ec2c1e commit c73d042

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export const envDeleteCommand = new Command<EnvCommandContext>()
298298
const envVar = envVars.find((envVar) => envVar.key === variable);
299299

300300
if (!envVar) {
301-
throw new Error(`Environment variable '${variable}' not found`);
301+
error(options.debug, `Environment variable '${variable}' not found`);
302302
}
303303

304304
// deno-lint-ignore no-explicit-any

main.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Command } from "@cliffy/command";
1+
import { Command } from "jsr:@cliffy/command@^1.0.0-rc.8";
22
import { publish } from "./publish.ts";
33
import { red, yellow } from "@std/fmt/colors";
44
import { greaterOrEqual, parse as semverParse } from "@std/semver";
@@ -273,8 +273,13 @@ deploy your local directory to the specified application.`)
273273
.option("--prod", "Deploy directly to production")
274274
.arguments("[root-path:string]")
275275
.globalAction((options) => {
276-
if (options.token) {
277-
token_storage.set(options.token, true);
276+
const endpoint = Deno.env.get("DENO_DEPLOY_ENDPOINT");
277+
if (endpoint) {
278+
options.endpoint = endpoint;
279+
}
280+
const tokenEnv = options.token || Deno.env.get("DENO_DEPLOY_TOKEN");
281+
if (tokenEnv) {
282+
token_storage.set(tokenEnv, true);
278283
}
279284
})
280285
.action(

util.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export async function withApp(
4848
): Promise<{ org: string; app: string | null }> {
4949
await getAuth(debug, deployUrl);
5050

51+
if (!org) {
52+
org = Deno.env.get("DENO_DEPLOY_ORG");
53+
}
54+
if (!app) {
55+
app = Deno.env.get("DENO_DEPLOY_APP");
56+
}
57+
5158
if (!org || !app) {
5259
const trpcClient = createTrpcClient(debug, deployUrl);
5360

0 commit comments

Comments
 (0)