Skip to content

Commit 34c0fa3

Browse files
authored
feat: support no config and passing org/app/token back (#27)
1 parent 3f7c2f2 commit 34c0fa3

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

main.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
envUpdateContextsCommand,
1515
envUpdateValueCommand,
1616
} from "./env.ts";
17-
import { createTrpcClient } from "./auth.ts";
17+
import { createTrpcClient, getAuth } from "./auth.ts";
1818
import token_storage from "./token_storage.ts";
1919
import {
2020
sandboxKillCommand,
@@ -145,6 +145,8 @@ const setupGCPCommand = new Command<GlobalOptions>()
145145

146146
const tunnelLoginCommand = new Command<GlobalOptions>()
147147
.arguments("[root-path:string]")
148+
.option("--really-no-config", "really no config")
149+
.option("--out <file:string>", "out file")
148150
.hidden()
149151
.action(async (options, rootPath = Deno.cwd()) => {
150152
const configContent = await readConfig(rootPath, options.config);
@@ -156,7 +158,16 @@ const tunnelLoginCommand = new Command<GlobalOptions>()
156158
org,
157159
app,
158160
);
159-
await writeConfig(configContent, gottenApp.org, gottenApp.app);
161+
if (options.reallyNoConfig !== true) {
162+
await writeConfig(configContent, gottenApp.org, gottenApp.app);
163+
}
164+
const token = await getAuth(options.debug, options.endpoint);
165+
if (options.out) {
166+
await Deno.writeTextFile(
167+
options.out,
168+
JSON.stringify({ org: gottenApp.org, app: gottenApp.app, token }),
169+
);
170+
}
160171
});
161172

162173
const envCommand = new Command<GlobalOptions>()
@@ -287,7 +298,7 @@ const logoutCommand = new Command()
287298
await new Command()
288299
.name("deno deploy")
289300
.description(`Interact with Deno Deploy
290-
301+
291302
Calling this subcommand without any further subcommands will
292303
deploy your local directory to the specified application.`)
293304
.globalOption("--endpoint <endpoint:string>", "the endpoint", {

0 commit comments

Comments
 (0)