File tree Expand file tree Collapse file tree 2 files changed +32
-6
lines changed
Expand file tree Collapse file tree 2 files changed +32
-6
lines changed Original file line number Diff line number Diff line change 22// SPDX-License-Identifier: Apache-2.0
33package trustedservices
44
5+ import (
6+ "encoding/json"
7+ "fmt"
8+ "os"
9+ )
10+
511type clientDetails struct {
6- Type string
7- Url string
8- Insecure bool
9- CaCerts []string
10- Hints []string
12+ Type string `json:"type"`
13+ Url string `json:"url"`
14+ Insecure bool `json:"in-secure"`
15+ CaCerts []string `json:"caCerts"`
16+ Hints []string `json:"hint"`
1117}
12- type DispatchInfo struct {
18+ type Dispatcher struct {
1319 ClientInfo map [string ]clientDetails
1420}
21+
22+ var lvDispatcher Dispatcher
23+
24+ // LoadDispatchTable loads the Dispatch Table from the configuration
25+ func LoadDispatchTable (fp string ) error {
26+ data , err := os .ReadFile (fp )
27+ if err != nil {
28+ return fmt .Errorf ("error reading dispatch table from %s: %w" , fp , err )
29+ }
30+ if err := json .Unmarshal (data , & lvDispatcher ); err != nil {
31+ return fmt .Errorf ("error unmarshalling dispatch table: %w" , err )
32+ }
33+ return nil
34+ }
Original file line number Diff line number Diff line change @@ -181,6 +181,12 @@ func (o *GRPC) Init(
181181 opts = append (opts , grpc .Creds (creds ))
182182 }
183183
184+ if cfg .DispatchTable != "" {
185+ if err := LoadDispatchTable (cfg .DispatchTable ); err != nil {
186+ return err
187+ }
188+ }
189+
184190 server := grpc .NewServer (opts ... )
185191 proto .RegisterVTSServer (server , o )
186192
You can’t perform that action at this time.
0 commit comments