UNPKG

2.8 kBTypeScriptView Raw
1export = entor;
2/**
3 * @typedef {Object} props
4 * @property {string} env Environment type, it prepends the files like `entor.<env>.json`. Example: `env = "local"` Entor will search the file `entor.local.json` on the defined `path`.
5 * @property {string} path Default `./`. The `entor.<env>.json` folder path from the root.
6 * @property {string} sharedEnvPath Default `undefined`. The **absolute path** to the shared environment folder path from the root. With `env = "local"` Entor will search for `local.shared.entor.json`.
7 * @property {function} getEnv Function that returns the `<env>`.
8 * @property {object} override JSON that will be merged with the `entor.<env>.json` content.
9 * @property {"none" | "message" | "throw"} warningLevel Default `message`
10 * Handles warnings behaviour:
11 * - `"none"`: Ignores all warnings.
12 * - `"message"`: Prints a warning message.
13 * - `"throw"`: Throws an error.
14 * @property {boolean} addToProcessEnv Default `true`. If `true` adds the `entor.<env>.json` content to the `process.env` object.
15 * @property {boolean} syncExamples Default `false`. If `true` syncs the `entor.<env>.json` file with the `entorExample.<env>.json` file.
16 *
17*/
18/**
19 * Run your node app with `--env=prod` to set the `env` on startup.
20 * @param {props} props
21*/
22declare function entor({ env, getEnv, path, sharedEnvPath, override, addToProcessEnv, warningLevel, syncExamples, }?: props): any;
23declare namespace entor {
24 export { props };
25}
26type props = {
27 /**
28 * Environment type, it prepends the files like `entor.<env>.json`. Example: `env = "local"` Entor will search the file `entor.local.json` on the defined `path`.
29 */
30 env: string;
31 /**
32 * Default `./`. The `entor.<env>.json` folder path from the root.
33 */
34 path: string;
35 /**
36 * Default `undefined`. The **absolute path** to the shared environment folder path from the root. With `env = "local"` Entor will search for `local.shared.entor.json`.
37 */
38 sharedEnvPath: string;
39 /**
40 * Function that returns the `<env>`.
41 */
42 getEnv: Function;
43 /**
44 * JSON that will be merged with the `entor.<env>.json` content.
45 */
46 override: object;
47 /**
48 * Default `message`
49 * Handles warnings behaviour:
50 * - `"none"`: Ignores all warnings.
51 * - `"message"`: Prints a warning message.
52 * - `"throw"`: Throws an error.
53 */
54 warningLevel: "none" | "message" | "throw";
55 /**
56 * Default `true`. If `true` adds the `entor.<env>.json` content to the `process.env` object.
57 */
58 addToProcessEnv: boolean;
59 /**
60 * Default `false`. If `true` syncs the `entor.<env>.json` file with the `entorExample.<env>.json` file.
61 */
62 syncExamples: boolean;
63};