sandlot/src/config.ts
2026-02-17 07:57:24 -08:00

29 lines
599 B
TypeScript

import { join } from "path"
export interface VmConfig {
cpus?: number
memory?: string
image?: string
mounts?: Record<string, string>
}
export interface SandlotConfig {
vm?: VmConfig
}
const DEFAULT_CONFIG: SandlotConfig = {
vm: { image: "ubuntu:24.04" },
}
export async function loadConfig(repoRoot: string): Promise<SandlotConfig> {
const path = join(repoRoot, "sandlot.json")
const file = Bun.file(path)
if (await file.exists()) {
const userConfig = await file.json()
return {
vm: { ...DEFAULT_CONFIG.vm, ...userConfig.vm },
}
}
return DEFAULT_CONFIG
}