github.com/ecolytiq/xk6-dotenv@v0.2.2-0.20220902071434-058cfd60158b/index.d.ts (about) 1 /** 2 * xk6-dotenv loads env vars from a .env file. 3 * 4 * This extension follow the [convention](https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use) for managing multiple environments (i.e. development, test, production). The actual environment name came from an env variable named `K6_ENV`. Setting this to `false` value disable the convention mentoined above and no dotenv file will be loaded automatically. 5 * 6 * | Hierarchy Priority | Filename | K6_ENV | Should I `.gitignore`it? | Notes | 7 * | ------------------ | ------------------------ | ---------------------- | ------------------------ | ------------------------------------------------------------ | 8 * | 1st (highest) | `.env.development.local` | development | Yes! | Local overrides of environment-specific settings. | 9 * | 1st | `.env.test.local` | test | Yes! | Local overrides of environment-specific settings. | 10 * | 1st | `.env.production.local` | production | Yes! | Local overrides of environment-specific settings. | 11 * | 2nd | `.env.local` | (any _expect_ `false`) | Definitely. | Local overrides. This file is loaded for all environments _except_ `test`. | 12 * | 3rd | `.env.development` | development | No. | Shared environment-specific settings | 13 * | 3rd | `.env.test` | test | No. | Shared environment-specific settings | 14 * | 3rd | `.env.production` | production | No. | Shared environment-specific settings | 15 * | Last | `.env` | (any _expect_ `false`) | Depends | The Original | 16 * 17 * ## Usage 18 * 19 * Import an entire module's contents: 20 * ```JavaScript 21 * import * as dotenv from "k6/x/dotenv"; 22 * ``` 23 * 24 * Import a single export from a module: 25 * ```JavaScript 26 * import { parse } from "k6/x/dotenv"; 27 * ``` 28 */ 29 30 /** 31 * The parse() method parses a .env format string, constructing the JavaScript object described by the string. 32 * 33 * @param text The string to parse as .env 34 * @returns The Object corresponding to the given .env variables. 35 */ 36 export declare function parse(text: string): Record<string, string>; 37 38 /** 39 * The stringify() method converts a JavaScript object to a .env format string. 40 * 41 * @param value The value to convert to a .env string 42 * @returns A .env format string representing the given object 43 */ 44 export declare function stringify(value: Record<string, string>): string;