add authentik

This commit is contained in:
Morten Olsen
2025-07-30 13:42:25 +02:00
parent dd1e5a8124
commit 523637d40f
27 changed files with 59686 additions and 340 deletions

24
scripts/create-clients.ts Normal file
View File

@@ -0,0 +1,24 @@
import fs from 'node:fs';
import { mkdir } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import YAML from 'yaml';
import openapiTS, { astToString } from 'openapi-typescript';
const schemaRequest = await fetch('https://authentik.olsen.cloud/api/v3/schema/');
if (!schemaRequest.ok) {
console.error(schemaRequest.status, schemaRequest.statusText);
throw new Error('Failed to fetch schema');
}
const schemaYaml = await schemaRequest.text();
const schema = YAML.parse(schemaYaml);
const ast = await openapiTS(schema);
const contents = astToString(ast);
const targetLocation = resolve(import.meta.dirname, '..', 'src', 'clients', 'authentik', 'authentik.types.d.ts');
await mkdir(dirname(targetLocation), { recursive: true });
fs.writeFileSync(
targetLocation,
['// This file is generated by scripts/create-clients.ts', '/* eslint-disable */', contents].join('\n'),
);

2
scripts/recreate.bash Executable file
View File

@@ -0,0 +1,2 @@
kubectl delete -f "$1"
kubectl apply -f "$1"