How to use the dotenv.recipe function in dotenv

To help you get started, we’ve selected a few dotenv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feater-dev / feater / server / src / config / config.ts View on Github external
import { ConfigInterface } from './config.interface';
import * as process from 'process';
import * as dotenv from 'dotenv';
import * as path from 'path';

if (process.env.FEATER_ENV_FILE) {
    const dotenvResult = dotenv.recipe({ path: process.env.FEATER_ENV_FILE });

    if (dotenvResult.error) {
        throw dotenvResult.error;
    }
}

export const config: ConfigInterface = {
    mongo: {
        dsn: process.env.FEATER_MONGO_DSN,
    },
    guestPaths: {
        root: path.join(__dirname, '../..'),
        asset: process.env.FEATER_GUEST_PATH_ASSET,
        build: process.env.FEATER_GUEST_PATH_BUILD,
        identity: process.env.FEATER_GUEST_PATH_IDENTITY,
        proxy: process.env.FEATER_GUEST_PATH_PROXY,

dotenv

Loads environment variables from .env file

BSD-2-Clause
Latest version published 2 months ago

Package Health Score

94 / 100
Full package analysis