From e4aee7b0e1c542394b4df9f7a0ceb224f3a56b9c Mon Sep 17 00:00:00 2001 From: fengmk2 Date: Tue, 12 Sep 2023 14:23:04 +0800 Subject: [PATCH] feat: auto set name and env on runtimeConfig --- standalone/standalone/src/Runner.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/standalone/standalone/src/Runner.ts b/standalone/standalone/src/Runner.ts index de96ff8f..a05969ea 100644 --- a/standalone/standalone/src/Runner.ts +++ b/standalone/standalone/src/Runner.ts @@ -33,6 +33,7 @@ export interface RunnerOptions { */ innerObjects?: Record; env?: string; + name?: string; innerObjectHandlers?: Record; } @@ -41,6 +42,7 @@ export class Runner { readonly moduleReferences: readonly ModuleReference[]; readonly moduleConfigs: Record; readonly env?: string; + readonly name?: string; private loadUnitLoader: EggModuleLoader; private runnerProto: EggPrototype; private configSourceEggPrototypeHook: ConfigSourceLoadUnitHook; @@ -59,6 +61,7 @@ export class Runner { constructor(cwd: string, options?: RunnerOptions) { this.cwd = cwd; this.env = options?.env; + this.name = options?.name; this.moduleReferences = ModuleConfigUtil.readModuleReference(this.cwd); this.moduleConfigs = {}; this.innerObjects = { @@ -70,6 +73,8 @@ export class Runner { const runtimeConfig: Partial = { baseDir: this.cwd, + name: this.name, + env: this.env, }; // Inject runtimeConfig this.innerObjects.runtimeConfig = [{