fix: define globals for context
This commit is contained in:
parent
296e4d489c
commit
e36352b7f3
@ -105,8 +105,8 @@ const headscaleConfig = type({
|
||||
magic_dns: goBool.default(true),
|
||||
base_domain: 'string = "headscale.net"',
|
||||
nameservers: type({
|
||||
'global?': 'string[]',
|
||||
'split': type('Record<string, string[]>').default(() => ({})),
|
||||
global: type('string[]').default(() => []),
|
||||
split: type('Record<string, string[]>').default(() => ({})),
|
||||
}).default(() => ({ global: [], split: {} })),
|
||||
search_domains: type('string[]').default(() => []),
|
||||
extra_records: type({
|
||||
|
||||
@ -6,10 +6,6 @@ import log from '~server/utils/log';
|
||||
type OidcConfig = NonNullable<AppContext['context']['oidc']>;
|
||||
declare global {
|
||||
const __PREFIX__: string;
|
||||
const __oidc_context: {
|
||||
valid: boolean;
|
||||
secret: string;
|
||||
};
|
||||
}
|
||||
|
||||
// We try our best to infer the callback URI of our Headplane instance
|
||||
@ -260,7 +256,7 @@ export function formatError(error: unknown) {
|
||||
}
|
||||
|
||||
export function oidcEnabled() {
|
||||
return __oidc_valid;
|
||||
return __oidc_context.valid;
|
||||
}
|
||||
|
||||
export async function testOidc(oidc: OidcConfig) {
|
||||
|
||||
21
server/context/globals.ts
Normal file
21
server/context/globals.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { HeadplaneConfig } from './parser';
|
||||
|
||||
declare global {
|
||||
const __cookie_context: {
|
||||
cookie_secret: string;
|
||||
cookie_secure: boolean;
|
||||
};
|
||||
|
||||
const __hs_context: {
|
||||
url: string;
|
||||
config_path?: string;
|
||||
config_strict?: boolean;
|
||||
};
|
||||
|
||||
const __oidc_context: {
|
||||
valid: boolean;
|
||||
secret: string;
|
||||
};
|
||||
|
||||
let __integration_context: HeadplaneConfig['integration'];
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user