Skip to content

Commit eb6a5cc

Browse files
authored
fix: perform auth for all the commands of grpc which requires controlplane (#2447)
1 parent 7bb0be1 commit eb6a5cc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cli/src/commands/grpc-service/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Command } from 'commander';
22
import { BaseCommandOptions } from '../../core/types/types.js';
3+
import { checkAuth } from '../auth/utils.js';
34
import generateCommand from './commands/generate.js';
45
import initCommand from './commands/init.js';
56
import listTemplatesCommand from './commands/list-templates.js';
@@ -17,5 +18,12 @@ export default (opts: BaseCommandOptions) => {
1718
command.addCommand(publishCommand(opts));
1819
command.addCommand(deleteCommand(opts));
1920

21+
command.hook('preAction', async (thisCmd) => {
22+
if (['generate', 'init', 'list-templates'].includes(thisCmd.args[0])) {
23+
return;
24+
}
25+
await checkAuth();
26+
});
27+
2028
return command;
2129
};

0 commit comments

Comments
 (0)