chore: log about context loading

This commit is contained in:
Aarnav Tale 2024-05-30 10:28:37 -04:00
parent dbd9d39da9
commit 868d85bbeb
No known key found for this signature in database
5 changed files with 17 additions and 3 deletions

View File

@ -7,6 +7,9 @@ import { HeadscaleError, pull } from '~/utils/headscale'
import type { Integration } from '.'
// Integration name
const name = 'Docker'
let url: URL | undefined
let container: string | undefined
@ -121,4 +124,4 @@ async function restart() {
}
}
export default { preflight, sighup, restart } satisfies Integration
export default { name, preflight, sighup, restart } satisfies Integration

View File

@ -2,6 +2,7 @@ import docker from './docker'
import proc from './proc'
export interface Integration {
name: string
preflight: () => Promise<boolean>
sighup?: () => Promise<void>
restart?: () => Promise<void>

View File

@ -5,6 +5,9 @@ import { kill } from 'node:process'
import type { Integration } from '.'
// Integration name
const name = 'Native Linux (/proc)'
// Check if we have a /proc and if it's readable
async function preflight() {
if (platform() !== 'linux') {
@ -77,4 +80,4 @@ async function sighup() {
}
}
export default { preflight, sighup } satisfies Integration
export default { name, preflight, sighup } satisfies Integration

View File

@ -73,6 +73,13 @@ export async function loadContext(): Promise<HeadplaneContext> {
oidc: await checkOidc(config),
}
console.log('Completed loading the Headplane Context')
console.log('Headscale URL:', headscaleUrl)
console.log('Integration:', context.integration?.name ?? 'None')
console.log('Config:', contextData.read ? `Found ${contextData.write ? '' : '(Read Only)'}` : 'Unavailable')
console.log('ACL:', context.acl.read ? `Found ${context.acl.write ? '' : '(Read Only)'}` : 'Unavailable')
console.log('OIDC:', context.oidc ? 'Configured' : 'Unavailable')
return context
}

View File

@ -103,7 +103,7 @@ const HeadscaleConfig = z.object({
client_secret: z.string().optional(),
client_secret_path: z.string().optional(),
scope: z.array(z.string()).default(['openid', 'profile', 'email']),
extra_params: z.record(z.string()).default({}),
extra_params: z.record(z.unknown()).default({}),
allowed_domains: z.array(z.string()).optional(),
allowed_users: z.array(z.string()).optional(),
allowed_groups: z.array(z.string()).optional(),