feat: initial policy system and version (#29)

Resolves #22 #24 and #26
This commit is contained in:
Morten Olsen
2024-01-14 09:45:42 +01:00
committed by GitHub
parent c7ca97f041
commit eeaad68f6e
4 changed files with 18 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import superjson from 'superjson';
import type { Runtime } from '@morten-olsen/mini-loader-server';
import type { RootRouter } from '@morten-olsen/mini-loader-server';
import pkg from '../../package.json';
import { Context } from '../context/context.js';
const createClient = (context: Context) => {
@@ -14,6 +15,7 @@ const createClient = (context: Context) => {
httpBatchLink({
url: `${context.host}/trpc`,
headers: {
'x-version': pkg.version,
authorization: `Bearer ${context.token}`,
},
}),

View File

@@ -1,4 +1,5 @@
import { program } from 'commander';
import { Command, program } from 'commander';
import pkg from '../package.json';
import { loads } from './commands/loads/loads.js';
import { runs } from './commands/runs/runs.js';
import { logs } from './commands/logs/logs.js';
@@ -17,4 +18,12 @@ program.addCommand(local);
program.addCommand(auth);
program.addCommand(contexts);
program.version(pkg.version);
const version = new Command('version');
version.action(() => {
console.log(pkg.version);
});
program.addCommand(version);
await program.parseAsync();