From 4eb5dc79efd35f17e9eff907ff6cde7e58319b47 Mon Sep 17 00:00:00 2001 From: Alberto Quiles Date: Mon, 5 Oct 2026 10:10:51 +0200 Subject: [PATCH] feat: connect auth to onet - fix #16 --- seed.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/seed.ts b/seed.ts index 2b9f989..7bb102e 100644 --- a/seed.ts +++ b/seed.ts @@ -37,6 +37,7 @@ const INTEGRATIONS: Record = { }, }; const ONET_TOKEN_LABEL = "onet"; +const ONET_API = "http://localhost:9400/api/v1"; const STATIC_URL = "http://localhost:1995"; const ASSET_EDITOR_URL = "http://localhost:2030"; @@ -242,7 +243,10 @@ const regenerateToken = async ( return created!.token; }; -type Config = { auth?: Record }; +type Config = { + auth?: Record; + onet?: Record; +}; const updateConfig = async (path: string, update: (config: Config) => void) => { try { @@ -297,12 +301,19 @@ const assetEditorToken = await regenerateToken( { url: ASSET_EDITOR_URL }, ownerSession, ); +const onetServiceToken = Array.from( + crypto.getRandomValues(new Uint8Array(32)), + (byte) => byte.toString(16).padStart(2, "0"), +).join(""); await updateConfig(join(reposDir, "openhotel/app/server/config.yml"), (c) => { c.auth = { ...c.auth, enabled: true, licenseToken: clientLicense }; }); await updateConfig(join(reposDir, "onet/config.yml"), (c) => { - c.auth = { ...c.auth, token: onetToken }; + c.auth = { ...c.auth, token: onetToken, serviceToken: onetServiceToken }; +}); +await updateConfig(join(reposDir, "auth/app/server/config.yml"), (c) => { + c.onet = { ...c.onet, enabled: true, api: ONET_API, token: onetServiceToken }; }); await updateConfig(join(reposDir, "web/app/server/config.yml"), (c) => { c.auth = { ...c.auth, enabled: true, licenseToken: webLicense };