diff --git a/src/controller/index.ts b/src/controller/index.ts index 936aed9..8e2a94a 100644 --- a/src/controller/index.ts +++ b/src/controller/index.ts @@ -37,7 +37,17 @@ export class ScramjetController { }, }; - this.config = Object.assign({}, defaultConfig, config); + const deepMerge = (target: any, source: any): any => { + for (const key in source) { + if (source[key] instanceof Object && key in target) { + Object.assign(source[key], deepMerge(target[key], source[key])); + } + } + + return Object.assign(target || {}, source); + }; + + this.config = deepMerge(defaultConfig, config); } async init(serviceWorkerPath: string): Promise {