Fix env config in server

pull/2413/head
Jérémy Rialland 2022-11-23 18:30:48 +01:00 committed by Jérémy Rialland
parent 72b02990e6
commit 507618c730
2 changed files with 5 additions and 4 deletions

View File

@ -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')
}

View File

@ -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