This commit is contained in:
Tutur33
2023-11-24 22:35:41 +01:00
parent 3c0b507a93
commit 7644b2a0f7
45165 changed files with 4803356 additions and 3 deletions
+59
View File
@@ -0,0 +1,59 @@
/// <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;
}