Initial standalone server implementation (#15)

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov
2021-08-08 23:04:39 +02:00
committed by GitHub
parent 67940e0d35
commit a8693be822
41 changed files with 349 additions and 174 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
APP_ACCOUNTS_URL=https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/
ACCOUNTS_URL=https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/
+2 -1
View File
@@ -63,6 +63,7 @@
"@anticrm/recruit-assets": "~0.6.0",
"@anticrm/recruit-resources": "~0.6.0",
"@anticrm/server-chunter": "~0.6.0",
"@anticrm/dev-server-chunter-resources": "~0.6.0"
"@anticrm/dev-server-chunter-resources": "~0.6.0",
"@anticrm/client-resources": "~0.6.0"
}
}
+5 -8
View File
@@ -36,15 +36,12 @@ import { setMetadata } from '@anticrm/platform'
export function configurePlatform() {
console.log(process.env.APP_ACCOUNTS_URL)
setMetadata(login.metadata.AccountsUrl, process.env.ACCOUNTS_URL)
setMetadata(login.metadata.OverrideLoginToken, process.env.LOGIN_TOKEN)
setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT)
// setMetadata(login.metadata.AccountsUrl, 'https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/')
setMetadata(login.metadata.AccountsUrl, process.env.APP_ACCOUNTS_URL)
// if (process.env.CLIENT === 'dev')
addLocation(clientId, () => import(/* webpackChunkName: "client-dev" */ '@anticrm/dev-client-resources'))
// else
// addLocation(core, () => import(/* webpackChunkName: "plugin-core" */ '@anticrm/plugin-core-impl'))
// addLocation(clientId, () => import(/* webpackChunkName: "client-dev" */ '@anticrm/dev-client-resources'))
addLocation(clientId, () => import(/* webpackChunkName: "client-dev" */ '@anticrm/client-resources'))
addLocation(loginId, () => import(/* webpackChunkName: "login" */ '@anticrm/login-resources'))
addLocation(workbenchId, () => import(/* webpackChunkName: "workbench" */ '@anticrm/workbench-resources'))
+4 -1
View File
@@ -23,6 +23,9 @@
"@anticrm/dev-storage": "~0.6.3",
"@anticrm/server-ws": "~0.6.4",
"@anticrm/core": "~0.6.7",
"@anticrm/platform": "~0.6.5"
"@anticrm/platform": "~0.6.5",
"jwt-simple": "~0.5.6",
"@anticrm/server-chunter": "~0.6.0",
"@anticrm/dev-server-chunter-resources": "~0.6.3"
}
}
+5
View File
@@ -16,5 +16,10 @@
import { start } from '.'
import { encode } from 'jwt-simple'
const token = encode({ email: 'rosamund@hc.engineering', workspace: 'ws1' }, 'secret')
console.log(token)
// eslint-disable-next-line @typescript-eslint/no-floating-promises
start(3333)
+5
View File
@@ -18,10 +18,15 @@ import { start as startJsonRpc } from '@anticrm/server-ws'
import { createStorage } from '@anticrm/dev-storage'
import { DevSession } from './session'
import { addLocation } from '@anticrm/platform'
import { serverChunterId } from '@anticrm/server-chunter'
/**
* @public
*/
export async function start (port: number, host?: string): Promise<void> {
addLocation(serverChunterId, () => import('@anticrm/dev-server-chunter-resources'))
const storage = await createStorage()
startJsonRpc(server => new DevSession(server, storage), port, host)
}
+1
View File
@@ -30,6 +30,7 @@ export class DevSession implements Storage {
async tx (tx: Tx): Promise<void> {
const derived = await this.storage.tx(tx)
this.server.broadcast(this, { result: tx })
for (const tx of derived) {
this.server.broadcast(this, { result: tx })
}