mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add controls for gms-errors to log or throw
This commit is contained in:
parent
6c75705cc3
commit
73382fce3d
@ -143,6 +143,7 @@ const federation = {
|
||||
|
||||
const gms = {
|
||||
GMS_ACTIVE: process.env.GMS_ACTIVE === 'true' || false,
|
||||
GMS_CREATE_USER_THROW_ERRORS: process.env.GMS_CREATE_USER_THROW_ERRORS === 'true' || false,
|
||||
// koordinates of Illuminz-instance of GMS
|
||||
GMS_URL: process.env.GMS_HOST ?? 'http://localhost:4044/',
|
||||
}
|
||||
|
||||
@ -376,7 +376,11 @@ export class UserResolver {
|
||||
await sendUserToGms(dbUser, homeCom)
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error('Error publishing new created user to GMS:', err)
|
||||
if (CONFIG.GMS_CREATE_USER_THROW_ERRORS) {
|
||||
throw new LogError('Error publishing new created user to GMS:', err)
|
||||
} else {
|
||||
logger.error('Error publishing new created user to GMS:', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return new User(dbUser)
|
||||
|
||||
@ -3,6 +3,7 @@ import { User as DbUser } from '@entity/User'
|
||||
|
||||
import { createGmsUser } from '@/apis/gms/GmsClient'
|
||||
import { GmsUser } from '@/apis/gms/model/GmsUser'
|
||||
import { CONFIG } from '@/config'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { backendLogger as logger } from '@/server/logger'
|
||||
|
||||
@ -22,6 +23,10 @@ export async function sendUserToGms(user: DbUser, homeCom: DbCommunity): Promise
|
||||
logger.debug('mark user as gms published:', user)
|
||||
}
|
||||
} catch (err) {
|
||||
logger.warn('publishing user fails with ', err)
|
||||
if (CONFIG.GMS_CREATE_USER_THROW_ERRORS) {
|
||||
throw new LogError('publishing user fails with ', err)
|
||||
} else {
|
||||
logger.warn('publishing user fails with ', err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user