mirror of
https://github.com/morten-olsen/homelab-operator.git
synced 2026-02-08 01:36:28 +01:00
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import 'dotenv/config';
|
|
import { ApiException } from '@kubernetes/client-node';
|
|
|
|
import { CustomResourceRegistry } from './custom-resource/custom-resource.registry.ts';
|
|
import { Services } from './utils/service.ts';
|
|
import { SecretRequest } from './crds/secrets/secrets.request.ts';
|
|
import { PostgresDatabase } from './crds/postgres/postgres.database.ts';
|
|
import { AuthentikClient } from './crds/authentik/client/client.ts';
|
|
import { Domain } from './crds/domain/domain/domain.ts';
|
|
import { DomainEndpoint } from './crds/domain/endpoint/endpoint.ts';
|
|
import { AuthentikServer } from './crds/authentik/server/server.ts';
|
|
|
|
process.on('uncaughtException', (error) => {
|
|
console.log('UNCAUGHT EXCEPTION');
|
|
if (error instanceof ApiException) {
|
|
return console.error(error.body);
|
|
}
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|
|
|
|
process.on('unhandledRejection', (error) => {
|
|
console.log('UNHANDLED REJECTION');
|
|
if (error instanceof Error) {
|
|
// show stack trace
|
|
console.error(error.stack);
|
|
}
|
|
if (error instanceof ApiException) {
|
|
return console.error(error.body);
|
|
}
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|
|
|
|
const services = new Services();
|
|
const registry = services.get(CustomResourceRegistry);
|
|
|
|
registry.register(new SecretRequest());
|
|
registry.register(new PostgresDatabase());
|
|
registry.register(new AuthentikServer());
|
|
registry.register(new AuthentikClient());
|
|
registry.register(new Domain());
|
|
registry.register(new DomainEndpoint());
|
|
|
|
await registry.install(true);
|
|
await registry.watch();
|