Add homelab installer and services (allprox, authelia, lldap)
This commit is contained in:
parent
68b23f1cbe
commit
bb754cdd8c
32 changed files with 2356 additions and 1 deletions
30
installer/scripts/generate-catalog.ts
Normal file
30
installer/scripts/generate-catalog.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { Catalog, ServiceMetadata } from "../src/types.ts";
|
||||
|
||||
const here = import.meta.dir;
|
||||
const repoRoot = join(here, "..", "..");
|
||||
const servicesDir = join(repoRoot, "services");
|
||||
|
||||
const services: Catalog["services"] = [];
|
||||
|
||||
for (const name of readdirSync(servicesDir).sort()) {
|
||||
const metaPath = join(servicesDir, name, "metadata.json");
|
||||
if (!statSync(metaPath, { throwIfNoEntry: false })?.isFile()) continue;
|
||||
|
||||
const meta = JSON.parse(readFileSync(metaPath, "utf8")) as ServiceMetadata;
|
||||
services.push({
|
||||
id: meta.id ?? name,
|
||||
version: meta.version ?? "unknown",
|
||||
path: `services/${name}/metadata.json`,
|
||||
});
|
||||
}
|
||||
|
||||
const catalog: Catalog = {
|
||||
generatedAt: new Date().toISOString(),
|
||||
services,
|
||||
};
|
||||
|
||||
const out = join(servicesDir, "catalog.json");
|
||||
writeFileSync(out, `${JSON.stringify(catalog, null, 2)}\n`, "utf8");
|
||||
console.log(`Wrote ${out} with ${services.length} services.`);
|
||||
Loading…
Add table
Add a link
Reference in a new issue