Environment Configuration Module (core/config-module.ts)

nitrostack · sample-apps/seizure-monitor/agentic-ai-ot-security/typescript/packages/core/src/core/config-module.ts · typescript · Apache-2.0
infra, dev-tools, lang:typescript, tag:config, tag:environment, tag:backend

Custom environment file parser and configuration service for TypeScript applications. Reuse for robust app configuration management.

// Source: https://github.com/nitrocloudofficial/nitrostack | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import 'reflect-metadata';
import * as fs from 'fs';
import * as path from 'path';

/**
 * Configuration Module Options
 */
export interface ConfigModuleOptions {
  /**
   * Path to .env file (relative to project root)
   */
  envFilePath?: string;
  
  /**
   * Whether to ignore .env file if it doesn't exist
   */
  ignoreEnvFile?: boolean;
  
  /**
   * Whether to validate environment variables
   */
  validate?: (config: Record<string, any>) => boolean;
  
  /**
   * Default values for environment variables
   */
  defaults?: Record<string, string>;
}

/**
 * Parse .env f

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key