Add dotenv and config instructions

This commit is contained in:
Henrik Hüttemann
2023-05-25 17:35:21 +02:00
parent efdd2c933f
commit 3d0f505961
6 changed files with 31 additions and 5 deletions
+5 -3
View File
@@ -1,9 +1,11 @@
import dotenv from 'dotenv'
dotenv.config()
import fs from 'node:fs'
import readline from 'node:readline'
import log from './logger'
import { whoami } from './synapse'
import { storage } from './storage'
import readline from 'node:readline'
import { RcUser, createUser } from './users'
import { storage } from './storage'
import { whoami } from './synapse'
log.info('rocketchat2matrix starts.')
+6 -2
View File
@@ -30,8 +30,12 @@ export function mapUser(rcUser: RcUser): MatrixUser {
}
}
const registration_shared_secret =
'vkq7zfBDt4A1NmMN6jJ*g+,G~.R:QuC_xI:~7~jQ_6kJ6O~JrG'
const registration_shared_secret = process.env.REGISTRATION_SHARED_SECRET || ''
if (!registration_shared_secret) {
const message = 'No REGISTRATION_SHARED_SECRET found in .env.'
log.error(message)
throw new Error(message)
}
function generateHmac(user: MatrixUser): string {
const hmac = createHmac('sha1', registration_shared_secret)