mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-06 14:16:39 +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"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/planetmint/planetmint-go/config"
|
"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
|
// TODO: revert to actual rddl-claim-service client after CosmosSDK upgrade to v0.50.x
|
||||||
@ -22,7 +24,11 @@ func lazyLoadShamirCoordinatorClient() IShamirCoordinatorClient {
|
|||||||
return ShamirCoordinatorServiceClient
|
return ShamirCoordinatorServiceClient
|
||||||
}
|
}
|
||||||
cfg := config.GetConfig()
|
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
|
return ShamirCoordinatorServiceClient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ mqtt-password = "{{ .PlmntConfig.MqttPassword }}"
|
|||||||
claim-host = "{{ .PlmntConfig.ClaimHost }}"
|
claim-host = "{{ .PlmntConfig.ClaimHost }}"
|
||||||
mqtt-tls = {{ .PlmntConfig.MqttTLS }}
|
mqtt-tls = {{ .PlmntConfig.MqttTLS }}
|
||||||
issuer-host = "{{ .PlmntConfig.IssuerHost }}"
|
issuer-host = "{{ .PlmntConfig.IssuerHost }}"
|
||||||
|
certs-path = "{{ .PlmntConfig.CertsPath }}"
|
||||||
`
|
`
|
||||||
|
|
||||||
// Config defines Planetmint's top level configuration
|
// Config defines Planetmint's top level configuration
|
||||||
@ -45,6 +46,7 @@ type Config struct {
|
|||||||
ClaimHost string `json:"claim-host" mapstructure:"claim-host"`
|
ClaimHost string `json:"claim-host" mapstructure:"claim-host"`
|
||||||
MqttTLS bool `json:"mqtt-tls" mapstructure:"mqtt-tls"`
|
MqttTLS bool `json:"mqtt-tls" mapstructure:"mqtt-tls"`
|
||||||
IssuerHost string `json:"issuer-host" mapstructure:"issuer-host"`
|
IssuerHost string `json:"issuer-host" mapstructure:"issuer-host"`
|
||||||
|
CertsPath string `json:"certs-path" mapstructure:"certs-path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// cosmos-sdk wide global singleton
|
// cosmos-sdk wide global singleton
|
||||||
@ -71,6 +73,7 @@ func DefaultConfig() *Config {
|
|||||||
ClaimHost: "https://testnet-p2r.rddl.io",
|
ClaimHost: "https://testnet-p2r.rddl.io",
|
||||||
MqttTLS: true,
|
MqttTLS: true,
|
||||||
IssuerHost: "https://testnet-issuer.rddl.io",
|
IssuerHost: "https://testnet-issuer.rddl.io",
|
||||||
|
CertsPath: "./certs/",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user