UBERF-9015: Remove confusing SYSTEM_EMAIL env (#7548)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2024-12-25 11:53:01 +07:00
committed by GitHub
parent fa4dc0dcbe
commit 9672f5064e
17 changed files with 29 additions and 47 deletions
+2 -2
View File
@@ -5,7 +5,7 @@
import client, { ClientSocket } from '@hcengineering/client'
import clientResources from '@hcengineering/client-resources'
import { Client, ClientConnectEvent } from '@hcengineering/core'
import { Client, ClientConnectEvent, systemAccountEmail } from '@hcengineering/core'
import { setMetadata } from '@hcengineering/platform'
import { getTransactorEndpoint } from '@hcengineering/server-client'
import serverToken, { generateToken } from '@hcengineering/server-token'
@@ -30,7 +30,7 @@ export async function createPlatformClient (
setMetadata(serverToken.metadata.Secret, config.ServerSecret)
const token = generateToken(
config.SystemEmail,
systemAccountEmail,
{
name: workspace
},
@@ -4,7 +4,7 @@
//
import { CollaboratorClient, getClient as getCollaboratorClient } from '@hcengineering/collaborator-client'
import { WorkspaceId } from '@hcengineering/core'
import { systemAccountEmail, WorkspaceId } from '@hcengineering/core'
import { generateToken } from '@hcengineering/server-token'
import config from './config'
@@ -12,6 +12,6 @@ import config from './config'
* @public
*/
export function createCollaboratorClient (workspaceId: WorkspaceId): CollaboratorClient {
const token = generateToken(config.SystemEmail, workspaceId, { mode: 'github' })
const token = generateToken(systemAccountEmail, workspaceId, { mode: 'github' })
return getCollaboratorClient(workspaceId, token, config.CollaboratorURL)
}
-6
View File
@@ -2,13 +2,10 @@
// Copyright © 2023 Hardcore Engineering Inc.
//
import { systemAccountEmail } from '@hcengineering/core'
interface Config {
AccountsURL: string
ServiceID: string
ServerSecret: string
SystemEmail: string
FrontURL: string
// '*' means all workspaces
@@ -36,7 +33,6 @@ const envMap: { [key in keyof Config]: string } = {
AccountsURL: 'ACCOUNTS_URL',
ServiceID: 'SERVICE_ID',
ServerSecret: 'SERVER_SECRET',
SystemEmail: 'SYSTEM_EMAIL',
FrontURL: 'FRONT_URL',
AppID: 'APP_ID',
@@ -62,7 +58,6 @@ const required: Array<keyof Config> = [
'AccountsURL',
'ServerSecret',
'ServiceID',
'SystemEmail',
'FrontURL',
'AppID',
'ClientID',
@@ -82,7 +77,6 @@ const config: Config = (() => {
AccountsURL: process.env[envMap.AccountsURL],
ServerSecret: process.env[envMap.ServerSecret],
ServiceID: process.env[envMap.ServiceID] ?? 'github-service',
SystemEmail: process.env[envMap.SystemEmail] ?? systemAccountEmail,
AllowedWorkspaces: process.env[envMap.AllowedWorkspaces]?.split(',') ?? ['*'],
FrontURL: process.env[envMap.FrontURL] ?? '',
+2 -1
View File
@@ -14,6 +14,7 @@ import core, {
MeasureContext,
RateLimiter,
Ref,
systemAccountEmail,
TxOperations
} from '@hcengineering/core'
import github, { GithubAuthentication, makeQuery, type GithubIntegration } from '@hcengineering/github'
@@ -730,7 +731,7 @@ export class PlatformWorker {
}
await rateLimiter.add(async () => {
const token = generateToken(
config.SystemEmail,
systemAccountEmail,
{
name: workspace
},