From 8ab535e4fbb771f441fe3024a876e63b35026364 Mon Sep 17 00:00:00 2001 From: David Whittington Date: Wed, 21 Jun 2023 14:08:04 -0500 Subject: [PATCH] feat(config): enable dotenv Adds and enables dotenv so that .env is used even when running outside of docker-compose. --- package.json | 1 + src/config.ts | 3 +++ yarn.lock | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/package.json b/package.json index 7ed2cc7f..c4099731 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "better-sqlite3": "^7.5.1", "cors": "^2.8.5", "crypto": "^1.0.1", + "dotenv": "^16.3.1", "express": "^4.18.1", "express-async-handler": "^1.2.0", "express-openapi-validator": "^5.0.1", diff --git a/src/config.ts b/src/config.ts index ca9962dc..ed4ad265 100644 --- a/src/config.ts +++ b/src/config.ts @@ -15,12 +15,15 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ +import dotenv from 'dotenv'; import crypto from 'node:crypto'; import { createFilter } from './filters.js'; import * as env from './lib/env.js'; import log from './log.js'; +dotenv.config(); + export const START_HEIGHT = +env.varOrDefault('START_HEIGHT', '0'); export const STOP_HEIGHT = +env.varOrDefault('STOP_HEIGHT', 'Infinity'); export const TRUSTED_NODE_URL = env.varOrDefault( diff --git a/yarn.lock b/yarn.lock index 76fd0a9e..a0f08a37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2637,6 +2637,11 @@ dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + duplexer3@^0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz"