From 09e63b31e2c5ae8ccacdf8ed724a3add2a976267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=BC=91?= Date: Mon, 19 Feb 2024 18:15:23 +0800 Subject: [PATCH] fix: etcd config can't change namespace --- packages/config/config.etcd.ts | 2 +- packages/config/config.factory.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/config/config.etcd.ts b/packages/config/config.etcd.ts index d2d682c..1b32c1e 100644 --- a/packages/config/config.etcd.ts +++ b/packages/config/config.etcd.ts @@ -10,12 +10,12 @@ import { NO_NAME_PROVIDE } from './config.messages'; export class EtcdConfig implements IConfig, OnModuleInit { private readonly retryInterval = 5000; private readonly logger = new Logger('ConfigModule'); - private readonly namespace = 'nestcloud-config/'; constructor( private readonly store: ConfigStore, private readonly client: IEtcd, private readonly name: string, + private readonly namespace: string = '', ) { } diff --git a/packages/config/config.factory.ts b/packages/config/config.factory.ts index 7d69ce0..3fbb1e5 100644 --- a/packages/config/config.factory.ts +++ b/packages/config/config.factory.ts @@ -20,7 +20,12 @@ export class ConfigFactory { client = new ConsulConfig(this.store, ref, this.options.name); break; case ETCD: - client = new EtcdConfig(this.store, ref, this.options.name); + client = new EtcdConfig( + this.store, + ref, + this.options.name, + this.options.namespace, + ); break; case KUBERNETES: client = new KubernetesConfig(