neoneo-go/pkg/config/basic_service.go
Anna Shaleva 6b4dd5703e config: unify BasicService config within existing services
There are no changes visible from the user side (at least for those
users who doesn't put Prometheus's or pprof's port in quotes), just
internal refactoring. From now and on, BasicService configuration is
used by RPC server config, TLS for RPC server, pprof and Prometheus.
2022-12-06 16:35:09 +03:00

19 lines
484 B
Go

package config
import (
"net"
"strconv"
)
// BasicService is used as a simple base for node services like Pprof, RPC or
// Prometheus monitoring.
type BasicService struct {
Enabled bool `yaml:"Enabled"`
Address string `yaml:"Address"`
Port uint16 `yaml:"Port"`
}
// FormatAddress returns the full service's address in the form of "address:port".
func (s BasicService) FormatAddress() string {
return net.JoinHostPort(s.Address, strconv.FormatUint(uint64(s.Port), 10))
}