mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 07:10:02 +00:00
UBERF-9015: Remove confusing SYSTEM_EMAIL env (#7548)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
fa4dc0dcbe
commit
9672f5064e
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
@ -441,7 +441,6 @@
|
|||||||
"CLIENT_SECRET": "${env:POD_GITHUB_CLIENT_SECRET}",
|
"CLIENT_SECRET": "${env:POD_GITHUB_CLIENT_SECRET}",
|
||||||
"PRIVATE_KEY": "${env:POD_GITHUB_PRIVATE_KEY}",
|
"PRIVATE_KEY": "${env:POD_GITHUB_PRIVATE_KEY}",
|
||||||
"COLLABORATOR_URL": "ws://localhost:3078",
|
"COLLABORATOR_URL": "ws://localhost:3078",
|
||||||
"SYSTEM_EMAIL": "anticrm@hc.engineering",
|
|
||||||
"MINIO_ENDPOINT": "localhost",
|
"MINIO_ENDPOINT": "localhost",
|
||||||
"MINIO_ACCESS_KEY": "minioadmin",
|
"MINIO_ACCESS_KEY": "minioadmin",
|
||||||
"MINIO_SECRET_KEY": "minioadmin",
|
"MINIO_SECRET_KEY": "minioadmin",
|
||||||
@ -463,7 +462,6 @@
|
|||||||
"args": ["src/index.ts"],
|
"args": ["src/index.ts"],
|
||||||
"env": {
|
"env": {
|
||||||
"ACCOUNTS_URL": "http://localhost:3000",
|
"ACCOUNTS_URL": "http://localhost:3000",
|
||||||
"SYSTEM_EMAIL": "anticrm@hc.engineering",
|
|
||||||
"SECRET": "secret",
|
"SECRET": "secret",
|
||||||
"DOCS_RELEASE_INTERVAL": "10000",
|
"DOCS_RELEASE_INTERVAL": "10000",
|
||||||
"DOCS_IN_REVIEW_CHECK_INTERVAL": "10000",
|
"DOCS_IN_REVIEW_CHECK_INTERVAL": "10000",
|
||||||
@ -523,7 +521,6 @@
|
|||||||
"MINIO_ACCESS_KEY": "minioadmin",
|
"MINIO_ACCESS_KEY": "minioadmin",
|
||||||
"MINIO_SECRET_KEY": "minioadmin",
|
"MINIO_SECRET_KEY": "minioadmin",
|
||||||
"SERVICE_ID": "sign-service",
|
"SERVICE_ID": "sign-service",
|
||||||
"SYSTEM_EMAIL": "",
|
|
||||||
"ACCOUNTS_URL": "http://localhost:3000",
|
"ACCOUNTS_URL": "http://localhost:3000",
|
||||||
"BRANDING_PATH": "${workspaceRoot}/services/sign/pod-sign/debug/branding.json"
|
"BRANDING_PATH": "${workspaceRoot}/services/sign/pod-sign/debug/branding.json"
|
||||||
},
|
},
|
||||||
|
@ -761,8 +761,7 @@ export async function createAcc (
|
|||||||
const salt = randomBytes(32)
|
const salt = randomBytes(32)
|
||||||
const hash = password !== null ? hashWithSalt(password, salt) : null
|
const hash = password !== null ? hashWithSalt(password, salt) : null
|
||||||
|
|
||||||
const systemEmails = [systemAccountEmail]
|
if (systemAccountEmail === email) {
|
||||||
if (systemEmails.includes(email)) {
|
|
||||||
ctx.error('system email used for account', { email })
|
ctx.error('system email used for account', { email })
|
||||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.AccountAlreadyExists, { account: email }))
|
throw new PlatformError(new Status(Severity.ERROR, platform.status.AccountAlreadyExists, { account: email }))
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ interface Config {
|
|||||||
Secret: string
|
Secret: string
|
||||||
Credentials: string
|
Credentials: string
|
||||||
WATCH_URL: string
|
WATCH_URL: string
|
||||||
SystemEmail: string
|
|
||||||
InitLimit: number
|
InitLimit: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +36,6 @@ const envMap: { [key in keyof Config]: string } = {
|
|||||||
ServiceID: 'SERVICE_ID',
|
ServiceID: 'SERVICE_ID',
|
||||||
Secret: 'SECRET',
|
Secret: 'SECRET',
|
||||||
Credentials: 'Credentials',
|
Credentials: 'Credentials',
|
||||||
SystemEmail: 'SYSTEM_EMAIL',
|
|
||||||
WATCH_URL: 'WATCH_URL',
|
WATCH_URL: 'WATCH_URL',
|
||||||
InitLimit: 'INIT_LIMIT'
|
InitLimit: 'INIT_LIMIT'
|
||||||
}
|
}
|
||||||
@ -52,7 +50,6 @@ const config: Config = (() => {
|
|||||||
AccountsURL: process.env[envMap.AccountsURL],
|
AccountsURL: process.env[envMap.AccountsURL],
|
||||||
ServiceID: process.env[envMap.ServiceID] ?? 'calendar-service',
|
ServiceID: process.env[envMap.ServiceID] ?? 'calendar-service',
|
||||||
Secret: process.env[envMap.Secret],
|
Secret: process.env[envMap.Secret],
|
||||||
SystemEmail: process.env[envMap.SystemEmail] ?? 'anticrm@hc.engineering',
|
|
||||||
Credentials: process.env[envMap.Credentials],
|
Credentials: process.env[envMap.Credentials],
|
||||||
InitLimit: parseNumber(process.env[envMap.InitLimit]) ?? 50,
|
InitLimit: parseNumber(process.env[envMap.InitLimit]) ?? 50,
|
||||||
WATCH_URL: process.env[envMap.WATCH_URL]
|
WATCH_URL: process.env[envMap.WATCH_URL]
|
||||||
|
@ -18,6 +18,7 @@ import contact, { Channel, Contact, type Employee, type PersonAccount } from '@h
|
|||||||
import core, {
|
import core, {
|
||||||
TxOperations,
|
TxOperations,
|
||||||
TxProcessor,
|
TxProcessor,
|
||||||
|
systemAccountEmail,
|
||||||
toIdMap,
|
toIdMap,
|
||||||
type Account,
|
type Account,
|
||||||
type Client,
|
type Client,
|
||||||
@ -34,7 +35,6 @@ import { Collection, type Db } from 'mongodb'
|
|||||||
import { CalendarClient } from './calendar'
|
import { CalendarClient } from './calendar'
|
||||||
import { CalendarController } from './calendarController'
|
import { CalendarController } from './calendarController'
|
||||||
import { getClient } from './client'
|
import { getClient } from './client'
|
||||||
import config from './config'
|
|
||||||
import { SyncHistory, type ProjectCredentials, type User } from './types'
|
import { SyncHistory, type ProjectCredentials, type User } from './types'
|
||||||
|
|
||||||
export class WorkspaceClient {
|
export class WorkspaceClient {
|
||||||
@ -159,7 +159,7 @@ export class WorkspaceClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async initClient (workspace: string): Promise<Client> {
|
private async initClient (workspace: string): Promise<Client> {
|
||||||
const token = generateToken(config.SystemEmail, { name: workspace })
|
const token = generateToken(systemAccountEmail, { name: workspace })
|
||||||
const client = await getClient(token)
|
const client = await getClient(token)
|
||||||
client.notify = (...tx: Tx[]) => {
|
client.notify = (...tx: Tx[]) => {
|
||||||
void this.txHandler(...tx)
|
void this.txHandler(...tx)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import client, { ClientSocket } from '@hcengineering/client'
|
import client, { ClientSocket } from '@hcengineering/client'
|
||||||
import clientResources from '@hcengineering/client-resources'
|
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 { setMetadata } from '@hcengineering/platform'
|
||||||
import { getTransactorEndpoint } from '@hcengineering/server-client'
|
import { getTransactorEndpoint } from '@hcengineering/server-client'
|
||||||
import serverToken, { generateToken } from '@hcengineering/server-token'
|
import serverToken, { generateToken } from '@hcengineering/server-token'
|
||||||
@ -30,7 +30,7 @@ export async function createPlatformClient (
|
|||||||
|
|
||||||
setMetadata(serverToken.metadata.Secret, config.ServerSecret)
|
setMetadata(serverToken.metadata.Secret, config.ServerSecret)
|
||||||
const token = generateToken(
|
const token = generateToken(
|
||||||
config.SystemEmail,
|
systemAccountEmail,
|
||||||
{
|
{
|
||||||
name: workspace
|
name: workspace
|
||||||
},
|
},
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import { CollaboratorClient, getClient as getCollaboratorClient } from '@hcengineering/collaborator-client'
|
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 { generateToken } from '@hcengineering/server-token'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
|
|
||||||
@ -12,6 +12,6 @@ import config from './config'
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export function createCollaboratorClient (workspaceId: WorkspaceId): CollaboratorClient {
|
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)
|
return getCollaboratorClient(workspaceId, token, config.CollaboratorURL)
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,10 @@
|
|||||||
// Copyright © 2023 Hardcore Engineering Inc.
|
// Copyright © 2023 Hardcore Engineering Inc.
|
||||||
//
|
//
|
||||||
|
|
||||||
import { systemAccountEmail } from '@hcengineering/core'
|
|
||||||
|
|
||||||
interface Config {
|
interface Config {
|
||||||
AccountsURL: string
|
AccountsURL: string
|
||||||
ServiceID: string
|
ServiceID: string
|
||||||
ServerSecret: string
|
ServerSecret: string
|
||||||
SystemEmail: string
|
|
||||||
FrontURL: string
|
FrontURL: string
|
||||||
|
|
||||||
// '*' means all workspaces
|
// '*' means all workspaces
|
||||||
@ -36,7 +33,6 @@ const envMap: { [key in keyof Config]: string } = {
|
|||||||
AccountsURL: 'ACCOUNTS_URL',
|
AccountsURL: 'ACCOUNTS_URL',
|
||||||
ServiceID: 'SERVICE_ID',
|
ServiceID: 'SERVICE_ID',
|
||||||
ServerSecret: 'SERVER_SECRET',
|
ServerSecret: 'SERVER_SECRET',
|
||||||
SystemEmail: 'SYSTEM_EMAIL',
|
|
||||||
FrontURL: 'FRONT_URL',
|
FrontURL: 'FRONT_URL',
|
||||||
|
|
||||||
AppID: 'APP_ID',
|
AppID: 'APP_ID',
|
||||||
@ -62,7 +58,6 @@ const required: Array<keyof Config> = [
|
|||||||
'AccountsURL',
|
'AccountsURL',
|
||||||
'ServerSecret',
|
'ServerSecret',
|
||||||
'ServiceID',
|
'ServiceID',
|
||||||
'SystemEmail',
|
|
||||||
'FrontURL',
|
'FrontURL',
|
||||||
'AppID',
|
'AppID',
|
||||||
'ClientID',
|
'ClientID',
|
||||||
@ -82,7 +77,6 @@ const config: Config = (() => {
|
|||||||
AccountsURL: process.env[envMap.AccountsURL],
|
AccountsURL: process.env[envMap.AccountsURL],
|
||||||
ServerSecret: process.env[envMap.ServerSecret],
|
ServerSecret: process.env[envMap.ServerSecret],
|
||||||
ServiceID: process.env[envMap.ServiceID] ?? 'github-service',
|
ServiceID: process.env[envMap.ServiceID] ?? 'github-service',
|
||||||
SystemEmail: process.env[envMap.SystemEmail] ?? systemAccountEmail,
|
|
||||||
AllowedWorkspaces: process.env[envMap.AllowedWorkspaces]?.split(',') ?? ['*'],
|
AllowedWorkspaces: process.env[envMap.AllowedWorkspaces]?.split(',') ?? ['*'],
|
||||||
FrontURL: process.env[envMap.FrontURL] ?? '',
|
FrontURL: process.env[envMap.FrontURL] ?? '',
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ import core, {
|
|||||||
MeasureContext,
|
MeasureContext,
|
||||||
RateLimiter,
|
RateLimiter,
|
||||||
Ref,
|
Ref,
|
||||||
|
systemAccountEmail,
|
||||||
TxOperations
|
TxOperations
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import github, { GithubAuthentication, makeQuery, type GithubIntegration } from '@hcengineering/github'
|
import github, { GithubAuthentication, makeQuery, type GithubIntegration } from '@hcengineering/github'
|
||||||
@ -730,7 +731,7 @@ export class PlatformWorker {
|
|||||||
}
|
}
|
||||||
await rateLimiter.add(async () => {
|
await rateLimiter.add(async () => {
|
||||||
const token = generateToken(
|
const token = generateToken(
|
||||||
config.SystemEmail,
|
systemAccountEmail,
|
||||||
{
|
{
|
||||||
name: workspace
|
name: workspace
|
||||||
},
|
},
|
||||||
|
@ -24,7 +24,6 @@ interface Config {
|
|||||||
Secret: string
|
Secret: string
|
||||||
Credentials: string
|
Credentials: string
|
||||||
WATCH_TOPIC_NAME: string
|
WATCH_TOPIC_NAME: string
|
||||||
SystemEmail: string
|
|
||||||
FooterMessage: string
|
FooterMessage: string
|
||||||
InitLimit: number
|
InitLimit: number
|
||||||
}
|
}
|
||||||
@ -39,7 +38,6 @@ const envMap: { [key in keyof Config]: string } = {
|
|||||||
ServiceID: 'SERVICE_ID',
|
ServiceID: 'SERVICE_ID',
|
||||||
Secret: 'SECRET',
|
Secret: 'SECRET',
|
||||||
Credentials: 'Credentials',
|
Credentials: 'Credentials',
|
||||||
SystemEmail: 'SYSTEM_EMAIL',
|
|
||||||
WATCH_TOPIC_NAME: 'WATCH_TOPIC_NAME',
|
WATCH_TOPIC_NAME: 'WATCH_TOPIC_NAME',
|
||||||
FooterMessage: 'FOOTER_MESSAGE',
|
FooterMessage: 'FOOTER_MESSAGE',
|
||||||
InitLimit: 'INIT_LIMIT'
|
InitLimit: 'INIT_LIMIT'
|
||||||
@ -55,7 +53,6 @@ const config: Config = (() => {
|
|||||||
AccountsURL: process.env[envMap.AccountsURL],
|
AccountsURL: process.env[envMap.AccountsURL],
|
||||||
ServiceID: process.env[envMap.ServiceID] ?? 'gmail-service',
|
ServiceID: process.env[envMap.ServiceID] ?? 'gmail-service',
|
||||||
Secret: process.env[envMap.Secret],
|
Secret: process.env[envMap.Secret],
|
||||||
SystemEmail: process.env[envMap.SystemEmail] ?? 'anticrm@hc.engineering',
|
|
||||||
Credentials: process.env[envMap.Credentials],
|
Credentials: process.env[envMap.Credentials],
|
||||||
WATCH_TOPIC_NAME: process.env[envMap.WATCH_TOPIC_NAME],
|
WATCH_TOPIC_NAME: process.env[envMap.WATCH_TOPIC_NAME],
|
||||||
InitLimit: parseNumber(process.env[envMap.InitLimit]) ?? 50,
|
InitLimit: parseNumber(process.env[envMap.InitLimit]) ?? 50,
|
||||||
|
@ -20,6 +20,7 @@ import core, {
|
|||||||
type Doc,
|
type Doc,
|
||||||
MeasureContext,
|
MeasureContext,
|
||||||
type Ref,
|
type Ref,
|
||||||
|
systemAccountEmail,
|
||||||
type Tx,
|
type Tx,
|
||||||
type TxCreateDoc,
|
type TxCreateDoc,
|
||||||
TxProcessor,
|
TxProcessor,
|
||||||
@ -31,7 +32,6 @@ import type { StorageAdapter } from '@hcengineering/server-core'
|
|||||||
import { generateToken } from '@hcengineering/server-token'
|
import { generateToken } from '@hcengineering/server-token'
|
||||||
import { type Db } from 'mongodb'
|
import { type Db } from 'mongodb'
|
||||||
import { getClient } from './client'
|
import { getClient } from './client'
|
||||||
import config from './config'
|
|
||||||
import { GmailClient } from './gmail'
|
import { GmailClient } from './gmail'
|
||||||
import { type Channel, type ProjectCredentials, type User } from './types'
|
import { type Channel, type ProjectCredentials, type User } from './types'
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ export class WorkspaceClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async initClient (workspace: string): Promise<Client> {
|
private async initClient (workspace: string): Promise<Client> {
|
||||||
const token = generateToken(config.SystemEmail, { name: workspace })
|
const token = generateToken(systemAccountEmail, { name: workspace })
|
||||||
console.log('token', token, workspace)
|
console.log('token', token, workspace)
|
||||||
const client = await getClient(token)
|
const client = await getClient(token)
|
||||||
client.notify = (...tx: Tx[]) => {
|
client.notify = (...tx: Tx[]) => {
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
interface Config {
|
interface Config {
|
||||||
AccountsURL: string
|
AccountsURL: string
|
||||||
Port: number
|
Port: number
|
||||||
SystemEmail: string
|
|
||||||
ServiceID: string
|
ServiceID: string
|
||||||
|
|
||||||
LiveKitHost: string
|
LiveKitHost: string
|
||||||
@ -42,7 +41,6 @@ const envMap: { [key in keyof Config]: string } = {
|
|||||||
StorageProviderName: 'STORAGE_PROVIDER_NAME',
|
StorageProviderName: 'STORAGE_PROVIDER_NAME',
|
||||||
Secret: 'SECRET',
|
Secret: 'SECRET',
|
||||||
ServiceID: 'SERVICE_ID',
|
ServiceID: 'SERVICE_ID',
|
||||||
SystemEmail: 'SYSTEM_EMAIL',
|
|
||||||
MongoUrl: 'MONGO_URL'
|
MongoUrl: 'MONGO_URL'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +57,6 @@ const config: Config = (() => {
|
|||||||
StorageProviderName: process.env[envMap.StorageProviderName] ?? 's3',
|
StorageProviderName: process.env[envMap.StorageProviderName] ?? 's3',
|
||||||
Secret: process.env[envMap.Secret],
|
Secret: process.env[envMap.Secret],
|
||||||
ServiceID: process.env[envMap.ServiceID] ?? 'love-service',
|
ServiceID: process.env[envMap.ServiceID] ?? 'love-service',
|
||||||
SystemEmail: process.env[envMap.SystemEmail] ?? 'anticrm@hc.engineering',
|
|
||||||
MongoUrl: process.env[envMap.MongoUrl]
|
MongoUrl: process.env[envMap.MongoUrl]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,13 +12,20 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import core, { Client, Ref, TxOperations, type Blob, Data, MeasureContext } from '@hcengineering/core'
|
import attachment, { Attachment } from '@hcengineering/attachment'
|
||||||
|
import core, {
|
||||||
|
Client,
|
||||||
|
Data,
|
||||||
|
MeasureContext,
|
||||||
|
Ref,
|
||||||
|
systemAccountEmail,
|
||||||
|
TxOperations,
|
||||||
|
type Blob
|
||||||
|
} from '@hcengineering/core'
|
||||||
import drive, { createFile } from '@hcengineering/drive'
|
import drive, { createFile } from '@hcengineering/drive'
|
||||||
import love, { MeetingMinutes } from '@hcengineering/love'
|
import love, { MeetingMinutes } from '@hcengineering/love'
|
||||||
import { generateToken } from '@hcengineering/server-token'
|
import { generateToken } from '@hcengineering/server-token'
|
||||||
import attachment, { Attachment } from '@hcengineering/attachment'
|
|
||||||
import { getClient } from './client'
|
import { getClient } from './client'
|
||||||
import config from './config'
|
|
||||||
|
|
||||||
export class WorkspaceClient {
|
export class WorkspaceClient {
|
||||||
private client!: TxOperations
|
private client!: TxOperations
|
||||||
@ -39,7 +46,7 @@ export class WorkspaceClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async initClient (workspace: string): Promise<Client> {
|
private async initClient (workspace: string): Promise<Client> {
|
||||||
const token = generateToken(config.SystemEmail, { name: workspace })
|
const token = generateToken(systemAccountEmail, { name: workspace })
|
||||||
const client = await getClient(token)
|
const client = await getClient(token)
|
||||||
this.client = new TxOperations(client, core.account.System)
|
this.client = new TxOperations(client, core.account.System)
|
||||||
return this.client
|
return this.client
|
||||||
|
@ -11,7 +11,6 @@ export interface Config {
|
|||||||
Port: number
|
Port: number
|
||||||
Secret: string
|
Secret: string
|
||||||
ServiceID: string
|
ServiceID: string
|
||||||
SystemEmail: string
|
|
||||||
BrandingPath: string
|
BrandingPath: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +24,6 @@ const config: Config = (() => {
|
|||||||
Port: parseNumber(process.env.PORT) ?? 4006,
|
Port: parseNumber(process.env.PORT) ?? 4006,
|
||||||
Secret: process.env.SECRET,
|
Secret: process.env.SECRET,
|
||||||
ServiceID: process.env.SERVICE_ID,
|
ServiceID: process.env.SERVICE_ID,
|
||||||
SystemEmail: process.env.SYSTEM_EMAIL ?? 'anticrm@hc.engineering',
|
|
||||||
BrandingPath: process.env.BRANDING_PATH ?? ''
|
BrandingPath: process.env.BRANDING_PATH ?? ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { P12Signer } from '@signpdf/signer-p12'
|
|||||||
import signpdf from '@signpdf/signpdf'
|
import signpdf from '@signpdf/signpdf'
|
||||||
import { PDFDocument, StandardFonts, degrees, degreesToRadians, rgb } from 'pdf-lib'
|
import { PDFDocument, StandardFonts, degrees, degreesToRadians, rgb } from 'pdf-lib'
|
||||||
|
|
||||||
import config from './config'
|
import { systemAccountEmail } from '@hcengineering/core'
|
||||||
|
|
||||||
interface Rect {
|
interface Rect {
|
||||||
x: number
|
x: number
|
||||||
@ -50,7 +50,7 @@ export async function signPDF (file: Buffer, certp12: Buffer, pwd: string, ctx:
|
|||||||
// Make it configurable when will be needed to allow signing for different reasons.
|
// Make it configurable when will be needed to allow signing for different reasons.
|
||||||
const options: Options = {
|
const options: Options = {
|
||||||
name: ctx.title,
|
name: ctx.title,
|
||||||
contactInfo: config.SystemEmail,
|
contactInfo: systemAccountEmail,
|
||||||
appName: ctx.title,
|
appName: ctx.title,
|
||||||
reason: 'Export from the system',
|
reason: 'Export from the system',
|
||||||
location: 'N/A'
|
location: 'N/A'
|
||||||
|
@ -13,11 +13,10 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import { type Client } from '@hcengineering/core'
|
import { systemAccountEmail, type Client } from '@hcengineering/core'
|
||||||
import { generateToken, type Token } from '@hcengineering/server-token'
|
import { generateToken, type Token } from '@hcengineering/server-token'
|
||||||
|
|
||||||
import { createClient, getTransactorEndpoint } from '@hcengineering/server-client'
|
import { createClient, getTransactorEndpoint } from '@hcengineering/server-client'
|
||||||
import config from './config'
|
|
||||||
|
|
||||||
export class SignController {
|
export class SignController {
|
||||||
private readonly clients: Map<string, Client> = new Map<string, Client>()
|
private readonly clients: Map<string, Client> = new Map<string, Client>()
|
||||||
@ -50,7 +49,7 @@ export class SignController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async createPlatformClient (workspace: string): Promise<Client> {
|
private async createPlatformClient (workspace: string): Promise<Client> {
|
||||||
const token = generateToken(config.SystemEmail, {
|
const token = generateToken(systemAccountEmail, {
|
||||||
name: workspace
|
name: workspace
|
||||||
})
|
})
|
||||||
const endpoint = await getTransactorEndpoint(token)
|
const endpoint = await getTransactorEndpoint(token)
|
||||||
|
@ -12,7 +12,6 @@ interface Config {
|
|||||||
AccountsURL: string
|
AccountsURL: string
|
||||||
ServiceID: string
|
ServiceID: string
|
||||||
Secret: string
|
Secret: string
|
||||||
SystemEmail: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const envMap: { [key in keyof Config]: string } = {
|
const envMap: { [key in keyof Config]: string } = {
|
||||||
@ -28,8 +27,7 @@ const envMap: { [key in keyof Config]: string } = {
|
|||||||
|
|
||||||
AccountsURL: 'ACCOUNTS_URL',
|
AccountsURL: 'ACCOUNTS_URL',
|
||||||
ServiceID: 'SERVICE_ID',
|
ServiceID: 'SERVICE_ID',
|
||||||
Secret: 'SECRET',
|
Secret: 'SECRET'
|
||||||
SystemEmail: 'SYSTEM_EMAIL'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaults: Partial<Config> = {
|
const defaults: Partial<Config> = {
|
||||||
@ -45,7 +43,6 @@ const defaults: Partial<Config> = {
|
|||||||
|
|
||||||
AccountsURL: undefined,
|
AccountsURL: undefined,
|
||||||
ServiceID: 'telegram-service',
|
ServiceID: 'telegram-service',
|
||||||
SystemEmail: 'anticrm@hc.engineering',
|
|
||||||
|
|
||||||
Secret: undefined
|
Secret: undefined
|
||||||
}
|
}
|
||||||
@ -76,7 +73,6 @@ const config = (() => {
|
|||||||
MongoURI: process.env[envMap.MongoURI],
|
MongoURI: process.env[envMap.MongoURI],
|
||||||
AccountsURL: process.env[envMap.AccountsURL],
|
AccountsURL: process.env[envMap.AccountsURL],
|
||||||
ServiceID: process.env[envMap.ServiceID],
|
ServiceID: process.env[envMap.ServiceID],
|
||||||
SystemEmail: process.env[envMap.SystemEmail],
|
|
||||||
Secret: process.env[envMap.Secret]
|
Secret: process.env[envMap.Secret]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import core, {
|
|||||||
Hierarchy,
|
Hierarchy,
|
||||||
MeasureContext,
|
MeasureContext,
|
||||||
Ref,
|
Ref,
|
||||||
|
systemAccountEmail,
|
||||||
Tx,
|
Tx,
|
||||||
TxCreateDoc,
|
TxCreateDoc,
|
||||||
TxCUD,
|
TxCUD,
|
||||||
@ -31,7 +32,6 @@ import telegramP, { NewTelegramMessage } from '@hcengineering/telegram'
|
|||||||
import type { Collection } from 'mongodb'
|
import type { Collection } from 'mongodb'
|
||||||
import { Api } from 'telegram'
|
import { Api } from 'telegram'
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
import config from './config'
|
|
||||||
import { platformToTelegram, telegramToPlatform } from './markup'
|
import { platformToTelegram, telegramToPlatform } from './markup'
|
||||||
import { MsgQueue } from './queue'
|
import { MsgQueue } from './queue'
|
||||||
import type { TelegramConnectionInterface } from './telegram'
|
import type { TelegramConnectionInterface } from './telegram'
|
||||||
@ -151,7 +151,7 @@ export class WorkspaceWorker {
|
|||||||
lastMsgStorage: Collection<LastMsgRecord>,
|
lastMsgStorage: Collection<LastMsgRecord>,
|
||||||
channelsStorage: Collection<WorkspaceChannel>
|
channelsStorage: Collection<WorkspaceChannel>
|
||||||
): Promise<WorkspaceWorker> {
|
): Promise<WorkspaceWorker> {
|
||||||
const token = generateToken(config.SystemEmail, { name: workspace })
|
const token = generateToken(systemAccountEmail, { name: workspace })
|
||||||
const client = await createPlatformClient(token)
|
const client = await createPlatformClient(token)
|
||||||
|
|
||||||
const worker = new WorkspaceWorker(
|
const worker = new WorkspaceWorker(
|
||||||
|
Loading…
Reference in New Issue
Block a user