mirror of
https://github.com/tale/headplane.git
synced 2026-08-29 16:37:10 +00:00
feat: switch to config file system
This commit is contained in:
+15
-7
@@ -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} />
|
||||
</>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user