Skip to content

Commit

Permalink
stores an auth token (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikey authored Sep 13, 2022
1 parent 5878abd commit a950364
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/commands/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ const start = async () => {
};

// run the command when cli is called
export function run(code: string[]) {
start();
export function run(code: string[], options?: any) {
if (options?.authToken) {
// todo verify token is actually good before setting it
const token = options?.authToken;
getDb().set("config.token", token).write();
} else {
start();
}
}
6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ args
description:
"For functions, setting this will mark the function as private",
},
{
name: "auth-token",
description: "authorization token for the function",
},
{
name: "yes",
description:
Expand Down Expand Up @@ -137,7 +141,7 @@ args
"login",
"Login to the the CLI",
(name: string, sub: string[], options: any) => {
runLogin(sub);
runLogin(sub, options);
didRun = true;
}
)
Expand Down

0 comments on commit a950364

Please sign in to comment.