Where Are the Configuration Files for OmniRoute Located? A Complete Guide to the Config Directory
OmniRoute stores its runtime settings, feature toggles, internationalisation data, and quality-gate baselines in JSON files under the config/ directory, with additional environment and build configurations located in the project root.
The open-source OmniRoute repository (diegosouzapw/OmniRoute) centralizes its behavioral settings in a hierarchical configuration structure. Understanding the OmniRoute configuration files location is essential for administrators who need to customize request handling, localization, or quality thresholds without modifying core source code. These files are read by the server at startup and exposed through the Settings skill endpoints, allowing dynamic queries and modifications via the REST API.
Core Configuration Files in the config/ Directory
The primary OmniRoute configuration files reside in the repository’s config/ folder. These JSON files define runtime behavior and are imported directly by the application bootstrap process in src/server/init.ts.
Payload Validation Rules (config/payloadRules.json)
The config/payloadRules.json file contains rules that filter or reshape incoming request payloads, including size limits and prohibited fields. This configuration is consumed by the request-validation middleware located at src/middleware/payloadValidator.ts.
// src/lib/config/load.ts
import { readFileSync } from 'fs';
import { resolve } from 'path';
export function loadJson<T>(relativePath: string): T {
const fullPath = resolve(process.cwd(), relativePath);
const raw = readFileSync(fullPath, 'utf‑8');
return JSON.parse(raw) as T;
}
// Example usage during server initialization
const payloadRules = loadJson<Record<string, unknown>>('config/payloadRules.json');
console.log('Payload max size →', payloadRules.maxBytes);
Internationalisation Catalogue (config/i18n.json)
Global localization data is stored in config/i18n.json, which maps language codes to translation files used by both the UI and CLI components. The structure of this file is strictly enforced against config/i18n-schema.json by the validation layer in src/lib/validation/i18nValidator.ts.
Quality Gate Baselines (config/quality/*.json)
The config/quality/ directory contains baseline JSON files used by the Quality Gate tooling to enforce code-quality metrics such as complexity limits, duplication thresholds, and file-size constraints. These files are consumed by CI scripts located in scripts/check/quality/.
Root-Level Configuration Files
Beyond the dedicated config/ folder, OmniRoute utilizes several configuration files in the project root for build tooling, environment management, and dependency tracking:
.env.example— Template for environment variables required at runtime (API keys, database paths, feature flags). Developers copy this to.envand populate secrets for local development.tsconfig.json,tsconfig.typecheck‑core.json,tsconfig.typecheck‑noimplicit‑core.json— TypeScript compiler configurations for the main application and strict type-checking runs used in the build pipeline (npm run typecheck:*).package.jsonandpackage-lock.json— Define project dependencies, npm scripts, and package metadata..size-limit.json— Configuration for thesize-limittool to enforce bundle size caps during CI (npm run size-limit)..markdownlint.json— Linting rules for Markdown documentation enforced vianpm run lint:md.
Modifying Configuration via the Settings API
OmniRoute exposes configuration management through the Settings skill endpoints under /api/settings/*. These endpoints read from and write to the JSON configuration files at runtime, persisting changes back to disk or to a SQLite key-value store for transient settings.
Querying Current Configuration
Administrators can retrieve current payload rules via the REST API:
# Get the current payload rules
curl -X GET https://localhost:20128/api/settings/payload-rules \
-H "Authorization: Bearer $OMNIRoute_API_KEY"
The endpoint handler maps to src/lib/db/settings.ts, which reads directly from config/payloadRules.json.
Updating Configuration Programmatically
To modify settings without manual file editing, use the following pattern implemented in the Settings UI (pages/settings/payload-rules.tsx):
import { writeFileSync } from 'fs';
import { resolve } from 'path';
function updatePayloadRules(updates: Partial<Record<string, unknown>>) {
const cfgPath = resolve('config/payloadRules.json');
const current = JSON.parse(readFileSync(cfgPath, 'utf‑8'));
const merged = { ...current, ...updates };
writeFileSync(cfgPath, JSON.stringify(merged, null, 2));
}
// Increase the request‑size limit to 5 MiB
updatePayloadRules({ maxBytes: 5 * 1024 * 1024 });
Accessing i18n Data in the Frontend
Frontend components import internationalisation data directly from the configuration directory. The following React component found in src/app/components/LocaleSwitcher.tsx consumes config/i18n.json:
import localeData from '../../config/i18n.json';
export function LocaleSwitcher() {
return (
<select>
{Object.entries(localeData).map(([code, name]) => (
<option key={code} value={code}>
{name}
</option>
))}
</select>
);
}
This direct import pattern ensures the UI always reflects the current language catalogue defined in the OmniRoute configuration files location.
Summary
- Primary config location: The
config/directory containspayloadRules.json,i18n.json,i18n-schema.json, and thequality/subdirectory for runtime behavioral settings. - Environment and build configs: Root-level files including
.env.example,tsconfig*.json, andpackage.jsonmanage dependencies, TypeScript compilation, and environment variables. - Runtime loading: The
loadJsonutility insrc/lib/config/load.tsimports configuration files at startup, withsrc/server/init.tsorchestrating the initialization sequence. - API exposure: The Settings skill (
/api/settings/*) enables runtime querying and modification of configuration values, with persistence handled bysrc/lib/db/settings.ts. - Validation: JSON-Schema validation ensures
i18n.jsonconforms to expected structures viasrc/lib/validation/i18nValidator.ts.
Frequently Asked Questions
Where are the OmniRoute configuration files located?
OmniRoute configuration files are primarily located in the config/ directory at the repository root, with additional environment and build configuration files (such as .env.example and tsconfig.json) located in the project root. The config/ folder contains JSON files for payload rules, internationalisation, and quality gate baselines.
How does OmniRoute validate its internationalisation configuration?
OmniRoute validates the config/i18n.json file against the JSON-Schema defined in config/i18n-schema.json. This validation is performed by the src/lib/validation/i18nValidator.ts module at startup to ensure new languages conform to the expected structure before being loaded into the application.
Can I modify OmniRoute settings without restarting the server?
Yes, many settings can be modified at runtime via the Settings skill API endpoints (/api/settings/*). These endpoints read from and write to the configuration files directly, allowing administrators to update payload rules and other values dynamically. Changes are persisted back to the JSON files or to a SQLite key-value store for transient settings.
What is the purpose of the config/quality/ directory?
The config/quality/ directory contains baseline JSON files used by OmniRoute’s Quality Gate tooling. These files define thresholds for code-quality metrics such as complexity, duplication, and file-size limits, which are enforced during continuous integration runs via scripts in scripts/check/quality/.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →