From c439dc85dfbac3ae23a45c1989da1fc35617bc49 Mon Sep 17 00:00:00 2001 From: Juan Angel Date: Mon, 2 Jan 2023 23:15:44 +0100 Subject: [PATCH] feat: add support to dotenv files --- package-lock.json | 14 ++++++++++++++ package.json | 1 + src/index.ts | 3 +++ 3 files changed, 18 insertions(+) diff --git a/package-lock.json b/package-lock.json index 188e55e..426514c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@noble/secp256k1": "1.7.0", "debug": "4.3.4", + "dotenv": "^16.0.3", "joi": "17.7.0", "knex": "2.3.0", "pg": "8.8.0", @@ -3784,6 +3785,14 @@ "node": ">=8" } }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, "node_modules/duplexer2": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", @@ -15436,6 +15445,11 @@ "is-obj": "^2.0.0" } }, + "dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + }, "duplexer2": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", diff --git a/package.json b/package.json index 91a30c5..ee2b0a4 100644 --- a/package.json +++ b/package.json @@ -110,6 +110,7 @@ "dependencies": { "@noble/secp256k1": "1.7.0", "debug": "4.3.4", + "dotenv": "^16.0.3", "joi": "17.7.0", "knex": "2.3.0", "pg": "8.8.0", diff --git a/src/index.ts b/src/index.ts index af962ee..a60184a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,11 @@ import cluster from 'cluster' +import dotenv from 'dotenv' +dotenv.config() import { appFactory } from './factories/app-factory' import { workerFactory } from './factories/worker-factory' + export const getRunner = (isPrimary: boolean) => { return (isPrimary) ? appFactory()