Skip to content

Commit

Permalink
feat: configurable mocktr181 service name
Browse files Browse the repository at this point in the history
  • Loading branch information
denopink committed Apr 8, 2024
1 parent 7837ebc commit 4800736
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions cmd/xmidt-agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -346,6 +347,7 @@ var defaultConfig = Config{
},
},
MockTr181: MockTr181{
FilePath: "./mock_tr181.json",
FilePath: "./mock_tr181.json",
ServiceName: "config",
},
}
2 changes: 1 addition & 1 deletion cmd/xmidt-agent/wrphandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/xmidt-agent/xmidt_agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ operational_state:
# Optional
# storage:
# temporary: ~/local-rdk-testing/temporary
# durable: ~/local-rdk-testing/durable
# durable: ~/local-rdk-testing/durable
# mock_tr_181:
# enabled: true
# file_path: xmidt-agent/internal/wrphandlers/mocktr181/mock_tr181.json

0 comments on commit 4800736

Please sign in to comment.