Files
portfolio2023/node_modules/@adonisjs/env/build/src/Env/index.d.ts
T
2023-11-24 22:35:41 +01:00

60 lines
1.7 KiB
TypeScript

/// <reference path="../../adonis-typings/env.d.ts" />
import { DotenvParseOutput } from 'dotenv';
import { EnvContract, ValidateFn } from '@ioc:Adonis/Core/Env';
/**
* The ENV module enables the use of environment variables by parsing dotfiles syntax
* and updates the `process.env` object in Node.js.
*
* AdonisJs automatically reads and passes the contents of `.env` file to this class.
*/
export declare class Env implements EnvContract {
private valuesToProcess;
/**
* A boolean to know if the values have been processed or
* not
*/
private hasProcessedValues;
/**
* A cache of env values
*/
private envCache;
/**
* The schema to be used for validating and casting environment
* variables
*/
private validationSchema;
constructor(valuesToProcess: {
values: DotenvParseOutput;
overwriteExisting: boolean;
}[]);
/**
* Reference to the underlying schema
*/
schema: import("@ioc:Adonis/Core/Env").EnvSchema;
/**
* Process parsed env variables. The values will be validated
* against the validation schema
*/
process(): void;
/**
* Register the validation schema
*/
rules(schema: {
[key: string]: ValidateFn<unknown>;
}): any;
/**
* Returns the environment variable value. First the cached
* values are preferred. When missing, the value from
* "process.env" is used
*/
get(key: string, defaultValue?: any): any;
/**
* Set key-value pair. The value will be validated using
* the validation rule if exists.
*
* The original value is also updated on the `process.env`
* object
*/
set(key: string, value: any): void;
}