mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
add authentik
This commit is contained in:
24
scripts/create-clients.ts
Normal file
24
scripts/create-clients.ts
Normal 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
2
scripts/recreate.bash
Executable file
@@ -0,0 +1,2 @@
|
||||
kubectl delete -f "$1"
|
||||
kubectl apply -f "$1"
|
||||
Reference in New Issue
Block a user