0912bcff8d9c4b6659b2d58ba0d5ac23eeaa1109de44561785fe3741bdbde7884286045013ea814aae3c267a41e7c8c8cdf1890000d8d31d2e635503cf39d3 461 B

12345678910111213141516171819
  1. import { config, parse } from "dotenv";
  2. const env = config();
  3. const dbUrl: string | null =
  4. env.error || !env.parsed ? null : env.parsed["BASIC"];
  5. config({
  6. path: ".env-example",
  7. encoding: "utf8",
  8. debug: true
  9. });
  10. const parsed = parse("NODE_ENV=production\nDB_HOST=a.b.c");
  11. const dbHost: string = parsed["DB_HOST"];
  12. const parsedFromBuffer = parse(new Buffer("JUSTICE=league\n"), {
  13. debug: true
  14. });
  15. const justice: string = parsedFromBuffer["JUSTICE"];