Add CLIENT_ID and CLIENT_SECRET env var

pull/2325/head
Jérémy Rialland 2022-10-05 20:05:56 +02:00 committed by Jérémy Rialland
parent 55be375897
commit 88205b1511
5 changed files with 14 additions and 11 deletions

View File

@ -1 +1 @@
web: node -v ; yarn -v ; echo "APP_DIR: $APP_DIR" ; echo "PORT: $PORT" ; yarn workspace "$APP_DIR" run start:prod
web: node -v ; yarn -v ; echo "APP_DIR => $APP_DIR" ; echo "PORT => $PORT" ; yarn workspace "$APP_DIR" run start:prod

View File

@ -30,10 +30,7 @@
"resolveJsonModule": true,
/* Advanced Options */
"forceConsistentCasingInFileNames": true,
// temporary disable lib check waiting a fix for https://github.com/sindresorhus/got/issues/2051
"skipLibCheck": true
"forceConsistentCasingInFileNames": true
},
"ts-node": {
"esm": true

View File

@ -1,2 +1,4 @@
CLIENT_ID=
CLIENT_SECRET=
MONGO_URL=mongodb://root:example@localhost:27017/
ORIGIN=http://localhost:4000

View File

@ -1,13 +1,21 @@
import type { MattermostSendMessage } from './mattermost.js'
if (!process.env.MONGO_URL) {
throw new Error('MONGO_URL env var is empty')
}
if (!process.env.CLIENT_ID || !process.env.CLIENT_SECRET) {
throw new Error('Empty env var CLIENT_ID or CLIENT_SECRET')
}
export const PORT = process.env.PORT || 4000
export const ORIGIN = process.env.ORIGIN || 'http://localhost:4000'
export const MONGO_URL = process.env.MONGO_URL
export const NODE_ENV = process.env.NODE_ENV
export const serverUrl = 'https://mattermost.incubateur.net'
export const clientSecret = 'pgnch7w643yfdkdjnnjcxhpsoe'
export const clientId = 'wbkot91tjbd6byn4fbmrtu8h6o'
export const clientId = process.env.CLIENT_ID
export const clientSecret = process.env.CLIENT_SECRET
export const redirectUri = `${ORIGIN}/oauth`
const days = [

View File

@ -10,10 +10,6 @@ interface MemberIds {
}
export const initMongodb = async () => {
if (!MONGO_URL) {
throw new Error('MONGO_URL env var is empty')
}
const client = new MongoClient(MONGO_URL)
await client.connect()