DefinitelyTyped/types/dotenv-flow/dotenv-flow-tests.ts
Vincent Langlet faa5f11108 Add types
2019-01-25 18:18:01 +01:00

19 lines
486 B
TypeScript

import dotenv = require("dotenv-flow");
const env = dotenv.config();
const dbUrl: string | null = env.error || !env.parsed ? null : env.parsed["BASIC"];
dotenv.load({
cwd: "someDir",
encoding: "utf8",
purge_dotenv: true
});
const parsed = dotenv.parse("NODE_ENV=production\nDB_HOST=a.b.c");
const dbHost: string = parsed["DB_HOST"];
const parsedFromBuffer = dotenv.parse(new Buffer("JUSTICE=league\n"), {
debug: true
});
const justice: string = parsedFromBuffer["JUSTICE"];