Config
fusion.<env>.json and settings in Node.js (fusion-framework)
Overview
Runtime config is shared across languages: JSON files named fusion.<env>.json, selected by FUSION_ENV (default dev). Implementation lives in fusion-core; this package is fusion-framework (npm).
Full discovery rules, env placeholders, keys (host, port, fingerprint, swagger, …), and annotated fusion.dev.json / stage / prod:
import { settings, getSettings, configure } from "fusion-framework";
settings.ensureLoaded([process.cwd()]);
const host = settings.host;
const debug = settings.get("debug", false);Startup pattern
import { FusionApp, getSettings, settings } from "fusion-framework";
settings.ensureLoaded([process.cwd()]);
const app = new FusionApp(getSettings());
await app.listen();FusionApp listens on host / port from settings unless you pass overrides to listen(host, port). Scaffolded fusion.dev.json uses port 8080 (core bare default is 3000 if no JSON is found).
API
| API | Role |
|---|---|
settings.ensureLoaded(extraRoots?) | Discover and load fusion.<env>.json |
settings.loadJson(path?, env?, extraRoots?) | Explicit path / env |
settings.get(key, default?) | Nested key lookup |
settings.merge(object) | Overlay values |
configure(object) | Merge into the singleton |
getSettings() | { host, port, debug, env } snapshot for FusionApp |
Scaffolded core/settings.ts exports values for your code. Optional run({ settingsModule }) merges only exported HOST, PORT, and DEBUG if present — it does not merge every uppercase name the way Python does.
Switch environment
FUSION_ENV=prod npx tsx main.ts
fusion command run:prodcommands in JSON are for Fusion Tool, not the HTTP runtime.