node package manager

hapi-conf

hapi-conf

hapi-conf loads environment variables using dotenv and exposes with a hapi server method. Environment variables are filtered and parsed as JSON with filter-env.

Circle CI bitHound Overall Score bitHound Dependencies

Usage

The following example loads environment variables from .env and filters the variables

const fs = require('fs');
const Hapi = require('hapi');
const hapiConf = requre('hapi-conf');
const server = new Hapi.Server({});
hapiConf(server, /^TEST-/, { env: fs.readFileSync('./.env'), json: true, freeze: true });