mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-14 03:30:52 +08:00
fix: use in-process Harness API for local plugin connections
This commit is contained in:
parent
f4ded46278
commit
f0b6b38b45
40 changed files with 1413 additions and 603 deletions
|
|
@ -5,7 +5,7 @@ import { OfficeConfigStore } from '../../../../src/channels/office/config-store.
|
|||
import { OfficeController } from '../../../../src/channels/office/office-controller.mjs';
|
||||
import { OfficeRuntime } from '../../../../src/channels/office/office-runtime.mjs';
|
||||
import { HarnessClient } from '../../../../src/channels/shared/harness-client.mjs';
|
||||
import { harnessOrigin } from '../shared/production.mjs';
|
||||
import { harnessConnection } from '../../harness-connection.mjs';
|
||||
|
||||
export function officePaths(config = {}) {
|
||||
const dshHome = resolve(config.dshHome ?? process.env.DSH_HOME ?? join(homedir(), '.dsh'));
|
||||
|
|
@ -14,6 +14,7 @@ export function officePaths(config = {}) {
|
|||
}
|
||||
|
||||
export async function createProductionController(ctx, config = {}, internals = {}) {
|
||||
const connection = harnessConnection(ctx, config);
|
||||
const Store = internals.ConfigStore ?? OfficeConfigStore;
|
||||
const Controller = internals.Controller ?? OfficeController;
|
||||
const Runtime = internals.Runtime ?? OfficeRuntime;
|
||||
|
|
@ -21,9 +22,8 @@ export async function createProductionController(ctx, config = {}, internals = {
|
|||
const paths = officePaths(config);
|
||||
const configStore = await new Store(paths.config).load();
|
||||
const logger = typeof ctx.logger === 'function' ? ctx.logger('dsh-im:office') : (ctx.logger ?? console);
|
||||
const harnessBaseUrl = harnessOrigin(ctx.webServer, config.harnessBaseUrl);
|
||||
const createHarness = internals.createHarness ?? (({ workspace }) => new ResolvedHarness({
|
||||
baseUrl: harnessBaseUrl,
|
||||
...connection,
|
||||
workspace,
|
||||
autostart: false,
|
||||
dshBin: config.dshBin ?? 'dsh',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue