/** * Environment configuration for API authentication. * * Stores validated environment variables needed for the application to function, * primarily the PagerDuty API authentication token. * * @category Models * * @example * ```typescript * const env: Environment = { * API_TOKEN: 'your-pagerduty-api-token' * }; * ``` */ export interface Environment { /** * PagerDuty API authentication token. * Required for all API calls to PagerDuty. * Should be a valid PagerDuty REST API token with appropriate permissions. * * **SECURITY NOTE**: Never log this value in clear text. Use the automatic * masking provided by ConsoleLogger or sanitizeError() before logging. * * @see {@link https://support.pagerduty.com/docs/api-access-keys|PagerDuty API Access Keys} */ API_TOKEN: string; } /** * Validates and sanitizes environment variables for API access. * * This function ensures that the required API token is available, either from * the environment variables or a command-line override. It prioritizes the * command-line provided key over the environment variable. * * **SECURITY BEST PRACTICES**: * - API tokens are validated but never logged in clear text * - Use ConsoleLogger for any logging needs (automatic masking enabled) * - Use sanitizeError() from logger/utils before throwing/logging errors * - Avoid including tokens in error messages or stack traces * - Never expose token length or other metadata in validation messages * * @category Utilities * * @param envVars - Node.js process environment variables * @param apiKeyOverride - Optional API key provided via command-line (takes precedence) * * @returns Validated Environment object with API_TOKEN * * @throws {Error} If neither environment variable nor override provides an API token * * @example * ```typescript * // Using environment variable * const env = sanitiseEnvVariable(process.env); * * // Using command-line override * const env = sanitiseEnvVariable(process.env, 'cli-provided-token'); * ``` */ export declare function sanitiseEnvVariable(envVars: NodeJS.ProcessEnv, apiKeyOverride?: string): Environment; //# sourceMappingURL=EnvironmentController.d.ts.map