[#1170] innerring: Support morph mTLS

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-06-11 15:47:37 +03:00
parent a0e49fa5a5
commit 96fe271bab

View file

@ -463,9 +463,20 @@ func createClient(ctx context.Context, p *chainParams, errChan chan<- error) (*c
priority = defaultPriority
}
var mtlsConfig *client.MTLSConfig
rootCAs := p.cfg.GetStringSlice(fmt.Sprintf("%s.%d.trusted_ca_list", section, i))
if len(rootCAs) != 0 {
mtlsConfig = &client.MTLSConfig{
TrustedCAList: rootCAs,
KeyFile: p.cfg.GetString(fmt.Sprintf("%s.%d.key", section, i)),
CertFile: p.cfg.GetString(fmt.Sprintf("%s.%d.certificate", section, i)),
}
}
endpoints = append(endpoints, client.Endpoint{
Address: addr,
Priority: priority,
MTLSConfig: mtlsConfig,
})
}