From 4800736004c6b82cdcbc9e16d17910131b2024ce Mon Sep 17 00:00:00 2001 From: Owen Cabalceta Date: Mon, 8 Apr 2024 14:40:16 -0400 Subject: [PATCH] feat: configurable mocktr181 service name --- cmd/xmidt-agent/config.go | 8 +++++--- cmd/xmidt-agent/wrphandlers.go | 2 +- cmd/xmidt-agent/xmidt_agent.yaml | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/xmidt-agent/config.go b/cmd/xmidt-agent/config.go index 444aa6b..2d530e2 100644 --- a/cmd/xmidt-agent/config.go +++ b/cmd/xmidt-agent/config.go @@ -186,8 +186,9 @@ type Storage struct { } type MockTr181 struct { - FilePath string - Enabled bool + FilePath string + Enabled bool + ServiceName string } // Collect and process the configuration files and env vars and @@ -346,6 +347,7 @@ var defaultConfig = Config{ }, }, MockTr181: MockTr181{ - FilePath: "./mock_tr181.json", + FilePath: "./mock_tr181.json", + ServiceName: "config", }, } diff --git a/cmd/xmidt-agent/wrphandlers.go b/cmd/xmidt-agent/wrphandlers.go index 51ad752..4dc5d85 100644 --- a/cmd/xmidt-agent/wrphandlers.go +++ b/cmd/xmidt-agent/wrphandlers.go @@ -142,7 +142,7 @@ func providePubSubHandler(in pubsubIn) (pubsubOut, error) { return pubsubOut{}, errors.Join(ErrWRPHandlerConfig, err) } - mocktr, err := ps.SubscribeService("mocktr181", mocktr181Handler) + mocktr, err := ps.SubscribeService(in.MockTr181.ServiceName, mocktr181Handler) if err != nil { return pubsubOut{}, errors.Join(ErrWRPHandlerConfig, err) } diff --git a/cmd/xmidt-agent/xmidt_agent.yaml b/cmd/xmidt-agent/xmidt_agent.yaml index cc019a9..b23d900 100644 --- a/cmd/xmidt-agent/xmidt_agent.yaml +++ b/cmd/xmidt-agent/xmidt_agent.yaml @@ -27,4 +27,7 @@ operational_state: # Optional # storage: # temporary: ~/local-rdk-testing/temporary -# durable: ~/local-rdk-testing/durable \ No newline at end of file +# durable: ~/local-rdk-testing/durable +# mock_tr_181: +# enabled: true +# file_path: xmidt-agent/internal/wrphandlers/mocktr181/mock_tr181.json \ No newline at end of file