mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-05 21:56:45 +00:00
Fix rddl claim client load (#388)
* fix: lazyLoad on rddl-claim-service-client * fix: sane default value for claim-host --------- Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
b0f8516cd6
commit
066c1a7667
@ -16,13 +16,18 @@ import (
|
||||
|
||||
var ClaimServiceClient IRCClient
|
||||
|
||||
func init() {
|
||||
func lazyLoad() IRCClient {
|
||||
if ClaimServiceClient != nil {
|
||||
return ClaimServiceClient
|
||||
}
|
||||
cfg := config.GetConfig()
|
||||
ClaimServiceClient = NewRCClient(cfg.ClaimHost, &http.Client{})
|
||||
return ClaimServiceClient
|
||||
}
|
||||
|
||||
func PostClaim(ctx context.Context, beneficiary string, amount uint64, id uint64) (txID string, err error) {
|
||||
res, err := ClaimServiceClient.PostClaim(ctx, PostClaimRequest{Beneficiary: beneficiary, Amount: amount, ClaimID: int(id)})
|
||||
client := lazyLoad()
|
||||
res, err := client.PostClaim(ctx, PostClaimRequest{Beneficiary: beneficiary, Amount: amount, ClaimID: int(id)})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ func DefaultConfig() *Config {
|
||||
MqttPort: 1886,
|
||||
MqttUser: "user",
|
||||
MqttPassword: "password",
|
||||
ClaimHost: "testnet-p2r.rddl.io",
|
||||
ClaimHost: "https://testnet-p2r.rddl.io",
|
||||
MqttTLS: true,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user