feat: switch to config file system

This commit is contained in:
Aarnav Tale
2025-02-13 12:35:12 -05:00
parent 5be3cb345e
commit 76d263b7e6
28 changed files with 1071 additions and 883 deletions
+15 -7
View File
@@ -1,8 +1,13 @@
import Header from '~/components/Header';
import {
LoaderFunctionArgs,
Outlet,
redirect,
useLoaderData,
} from 'react-router';
import Footer from '~/components/Footer';
import Header from '~/components/Header';
import { getSession } from '~/utils/sessions.server';
import { loadContext } from '~/utils/config/headplane';
import { useLoaderData, LoaderFunctionArgs, Outlet, redirect } from 'react-router';
import { hp_getConfig, hs_getConfig } from '~/utils/state';
// This loads the bare minimum for the application to function
// So we know that if context fails to load then well, oops?
@@ -12,10 +17,13 @@ export async function loader({ request }: LoaderFunctionArgs) {
return redirect('/login');
}
const context = await loadContext();
const context = hp_getConfig();
const { mode, config } = hs_getConfig();
return {
config: context.config,
url: context.headscalePublicUrl ?? context.headscaleUrl,
config,
url: context.headscale.public_url ?? context.headscale.url,
configAvailable: mode !== 'no',
debug: context.debug,
user: session.get('user'),
};
@@ -29,5 +37,5 @@ export default function Shell() {
<Outlet />
<Footer {...data} />
</>
)
);
}