mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 12:55:59 +00:00
Fix server secret specification (#1054)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
d25cf50502
commit
7fc26783bc
@ -48,6 +48,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
environment:
|
environment:
|
||||||
|
- SERVER_PORT=3000
|
||||||
|
- SERVER_SECRET=secret
|
||||||
- MONGO_URL=mongodb://mongodb:27017
|
- MONGO_URL=mongodb://mongodb:27017
|
||||||
- TRANSACTOR_URL=ws://transactor:3333
|
- TRANSACTOR_URL=ws://transactor:3333
|
||||||
- ENDPOINT_URL=ws://localhost:3333
|
- ENDPOINT_URL=ws://localhost:3333
|
||||||
@ -64,6 +66,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8081:8080
|
- 8081:8080
|
||||||
environment:
|
environment:
|
||||||
|
- SERVER_PORT=8080
|
||||||
|
- SERVER_SECRET=secret
|
||||||
- ACCOUNTS_URL=http://localhost:3000
|
- ACCOUNTS_URL=http://localhost:3000
|
||||||
- FRONT_URL=http://localhost:8081
|
- FRONT_URL=http://localhost:8081
|
||||||
- UPLOAD_URL=/files
|
- UPLOAD_URL=/files
|
||||||
@ -82,6 +86,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3333:3333
|
- 3333:3333
|
||||||
environment:
|
environment:
|
||||||
|
- SERVER_PORT=3333
|
||||||
|
- SERVER_SECRET=secret
|
||||||
- ELASTIC_URL=http://elastic:9200
|
- ELASTIC_URL=http://elastic:9200
|
||||||
- MONGO_URL=mongodb://mongodb:27017
|
- MONGO_URL=mongodb://mongodb:27017
|
||||||
- METRICS_CONSOLE=true
|
- METRICS_CONSOLE=true
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
"koa-router": "^10.1.1",
|
"koa-router": "^10.1.1",
|
||||||
"koa-bodyparser": "^4.3.0",
|
"koa-bodyparser": "^4.3.0",
|
||||||
"@koa/cors": "^3.1.0",
|
"@koa/cors": "^3.1.0",
|
||||||
"@anticrm/server-tool": "~0.6.0"
|
"@anticrm/server-tool": "~0.6.0",
|
||||||
|
"@anticrm/server-token": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import { ACCOUNT_DB, methods } from '@anticrm/account'
|
import { ACCOUNT_DB, methods } from '@anticrm/account'
|
||||||
import toolPlugin from '@anticrm/server-tool'
|
import toolPlugin from '@anticrm/server-tool'
|
||||||
|
import serverToken from '@anticrm/server-token'
|
||||||
import platform, { Request, Response, serialize, setMetadata, Severity, Status } from '@anticrm/platform'
|
import platform, { Request, Response, serialize, setMetadata, Severity, Status } from '@anticrm/platform'
|
||||||
import cors from '@koa/cors'
|
import cors from '@koa/cors'
|
||||||
import { IncomingHttpHeaders } from 'http'
|
import { IncomingHttpHeaders } from 'http'
|
||||||
@ -39,6 +40,13 @@ if (transactorUri === undefined) {
|
|||||||
|
|
||||||
const endpointUri = process.env.ENDPOINT_URL ?? transactorUri
|
const endpointUri = process.env.ENDPOINT_URL ?? transactorUri
|
||||||
|
|
||||||
|
const serverSecret = process.env.SERVER_SECRET
|
||||||
|
if (serverSecret === undefined) {
|
||||||
|
console.log('Please provide server secret')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
setMetadata(serverToken.metadata.Secret, serverSecret)
|
||||||
setMetadata(toolPlugin.metadata.Endpoint, endpointUri)
|
setMetadata(toolPlugin.metadata.Endpoint, endpointUri)
|
||||||
setMetadata(toolPlugin.metadata.Transactor, transactorUri)
|
setMetadata(toolPlugin.metadata.Transactor, transactorUri)
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import { Client } from 'minio'
|
import { Client } from 'minio'
|
||||||
|
import { setMetadata } from '@anticrm/platform'
|
||||||
|
import serverToken from '@anticrm/server-token'
|
||||||
import { start } from './app'
|
import { start } from './app'
|
||||||
|
|
||||||
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
const SERVER_PORT = parseInt(process.env.SERVER_PORT ?? '8080')
|
||||||
@ -75,6 +77,14 @@ if (modelVersion === undefined) {
|
|||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverSecret = process.env.SERVER_SECRET
|
||||||
|
if (serverSecret === undefined) {
|
||||||
|
console.log('Please provide server secret')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
setMetadata(serverToken.metadata.Secret, serverSecret)
|
||||||
|
|
||||||
const config = { transactorEndpoint, elasticUrl, minio, accountsUrl, uploadUrl, modelVersion }
|
const config = { transactorEndpoint, elasticUrl, minio, accountsUrl, uploadUrl, modelVersion }
|
||||||
console.log('Starting Front service with', config)
|
console.log('Starting Front service with', config)
|
||||||
const shutdown = start(config, SERVER_PORT)
|
const shutdown = start(config, SERVER_PORT)
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
"@anticrm/server-recruit": "~0.6.0",
|
"@anticrm/server-recruit": "~0.6.0",
|
||||||
"@anticrm/server-recruit-resources": "~0.6.0",
|
"@anticrm/server-recruit-resources": "~0.6.0",
|
||||||
"@anticrm/server-task": "~0.6.0",
|
"@anticrm/server-task": "~0.6.0",
|
||||||
"@anticrm/server-task-resources": "~0.6.0"
|
"@anticrm/server-task-resources": "~0.6.0",
|
||||||
|
"@anticrm/server-token": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// Add this to the VERY top of the first file loaded in your app
|
// Add this to the VERY top of the first file loaded in your app
|
||||||
|
import { setMetadata } from '@anticrm/platform'
|
||||||
|
import serverToken from '@anticrm/server-token'
|
||||||
import { start } from '.'
|
import { start } from '.'
|
||||||
|
|
||||||
const serverPort = parseInt(process.env.SERVER_PORT ?? '3333')
|
const serverPort = parseInt(process.env.SERVER_PORT ?? '3333')
|
||||||
@ -55,6 +57,14 @@ const minioConf = {
|
|||||||
secretKey: minioSecretKey
|
secretKey: minioSecretKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serverSecret = process.env.SERVER_SECRET
|
||||||
|
if (serverSecret === undefined) {
|
||||||
|
console.log('Please provide server secret')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
setMetadata(serverToken.metadata.Secret, serverSecret)
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
console.log(`starting server on ${serverPort}`)
|
console.log(`starting server on ${serverPort}`)
|
||||||
const shutdown = start(url, elasticUrl, minioConf, serverPort)
|
const shutdown = start(url, elasticUrl, minioConf, serverPort)
|
||||||
|
@ -11,8 +11,7 @@ export const toolId = 'tool' as Plugin
|
|||||||
const toolPlugin = plugin(toolId, {
|
const toolPlugin = plugin(toolId, {
|
||||||
metadata: {
|
metadata: {
|
||||||
Endpoint: '' as Metadata<string>,
|
Endpoint: '' as Metadata<string>,
|
||||||
Transactor: '' as Metadata<string>,
|
Transactor: '' as Metadata<string>
|
||||||
Secret: '' as Metadata<string>
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ services:
|
|||||||
- 3003:3003
|
- 3003:3003
|
||||||
environment:
|
environment:
|
||||||
- ACCOUNT_PORT=3003
|
- ACCOUNT_PORT=3003
|
||||||
|
- SERVER_SECRET=secret
|
||||||
- MONGO_URL=mongodb://mongodb:27018
|
- MONGO_URL=mongodb://mongodb:27018
|
||||||
- TRANSACTOR_URL=ws://transactor:3334
|
- TRANSACTOR_URL=ws://transactor:3334
|
||||||
- ENDPOINT_URL=ws://localhost:3334
|
- ENDPOINT_URL=ws://localhost:3334
|
||||||
@ -62,6 +63,7 @@ services:
|
|||||||
- 8083:8083
|
- 8083:8083
|
||||||
environment:
|
environment:
|
||||||
- SERVER_PORT=8083
|
- SERVER_PORT=8083
|
||||||
|
- SERVER_SECRET=secret
|
||||||
- ACCOUNTS_URL=http://localhost:3003
|
- ACCOUNTS_URL=http://localhost:3003
|
||||||
- UPLOAD_URL=/files
|
- UPLOAD_URL=/files
|
||||||
- TRANSACTOR_URL=ws://localhost:3334
|
- TRANSACTOR_URL=ws://localhost:3334
|
||||||
@ -79,6 +81,7 @@ services:
|
|||||||
- 3334:3334
|
- 3334:3334
|
||||||
environment:
|
environment:
|
||||||
- SERVER_PORT=3334
|
- SERVER_PORT=3334
|
||||||
|
- SERVER_SECRET=secret
|
||||||
- ELASTIC_URL=http://elastic:9200
|
- ELASTIC_URL=http://elastic:9200
|
||||||
- MONGO_URL=mongodb://mongodb:27018
|
- MONGO_URL=mongodb://mongodb:27018
|
||||||
- METRICS_CONSOLE=true
|
- METRICS_CONSOLE=true
|
||||||
|
Loading…
Reference in New Issue
Block a user