Skip to content

Commit

Permalink
feat(config): enable dotenv
Browse files Browse the repository at this point in the history
Adds and enables dotenv so that .env is used even when running outside
of docker-compose.
  • Loading branch information
djwhitt committed Jun 21, 2023
1 parent f67817d commit 8ab535e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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(
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 8ab535e

Please sign in to comment.