diff --git a/server/source/config.ts b/server/source/config.ts index bef5cf569..808cc208b 100644 --- a/server/source/config.ts +++ b/server/source/config.ts @@ -1,5 +1,9 @@ +import dotenv from 'dotenv' + import type { MattermostSendMessage } from './mattermost.js' +dotenv.config() + if (!process.env.MONGO_URL) { throw new Error('Empty MONGO_URL env var') } diff --git a/server/source/server.ts b/server/source/server.ts index 78321324f..7ae592c06 100644 --- a/server/source/server.ts +++ b/server/source/server.ts @@ -1,8 +1,7 @@ import cors from '@koa/cors' import Router from '@koa/router' -import dotenv from 'dotenv' import Koa from 'koa' -import koaBody from 'koa-body' +import { koaBody } from 'koa-body' import { PORT, @@ -17,8 +16,6 @@ import { initMongodb } from './mongodb.js' import { getAccessToken } from './oauth.js' import { snakeToCamelCaseKeys, validateCrispBody } from './utils.js' -dotenv.config() - const mongo = await initMongodb() type KoaState = Koa.DefaultState