mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-05 21:56:45 +00:00
feat: add certs path and mtls setup for shamir coordinator client (#414)
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
7d87d662ea
commit
a4c8c821d0
@ -5,11 +5,13 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/planetmint/planetmint-go/config"
|
||||
"github.com/rddl-network/go-utils/tls"
|
||||
)
|
||||
|
||||
// TODO: revert to actual rddl-claim-service client after CosmosSDK upgrade to v0.50.x
|
||||
@ -22,7 +24,11 @@ func lazyLoadShamirCoordinatorClient() IShamirCoordinatorClient {
|
||||
return ShamirCoordinatorServiceClient
|
||||
}
|
||||
cfg := config.GetConfig()
|
||||
ShamirCoordinatorServiceClient = NewShamirCoordinatorClient(cfg.IssuerHost, &http.Client{})
|
||||
httpsClient, err := tls.Get2WayTLSClient(cfg.CertsPath)
|
||||
if err != nil {
|
||||
defer log.Fatal("fatal error setting up mutual tls client for shamir coordinator")
|
||||
}
|
||||
ShamirCoordinatorServiceClient = NewShamirCoordinatorClient(cfg.IssuerHost, httpsClient)
|
||||
return ShamirCoordinatorServiceClient
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ mqtt-password = "{{ .PlmntConfig.MqttPassword }}"
|
||||
claim-host = "{{ .PlmntConfig.ClaimHost }}"
|
||||
mqtt-tls = {{ .PlmntConfig.MqttTLS }}
|
||||
issuer-host = "{{ .PlmntConfig.IssuerHost }}"
|
||||
certs-path = "{{ .PlmntConfig.CertsPath }}"
|
||||
`
|
||||
|
||||
// Config defines Planetmint's top level configuration
|
||||
@ -45,6 +46,7 @@ type Config struct {
|
||||
ClaimHost string `json:"claim-host" mapstructure:"claim-host"`
|
||||
MqttTLS bool `json:"mqtt-tls" mapstructure:"mqtt-tls"`
|
||||
IssuerHost string `json:"issuer-host" mapstructure:"issuer-host"`
|
||||
CertsPath string `json:"certs-path" mapstructure:"certs-path"`
|
||||
}
|
||||
|
||||
// cosmos-sdk wide global singleton
|
||||
@ -71,6 +73,7 @@ func DefaultConfig() *Config {
|
||||
ClaimHost: "https://testnet-p2r.rddl.io",
|
||||
MqttTLS: true,
|
||||
IssuerHost: "https://testnet-issuer.rddl.io",
|
||||
CertsPath: "./certs/",
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user