Files
atom/providers/grpcs/config.go
2023-05-06 15:29:16 +08:00

31 lines
392 B
Go

package grpcs
import (
"fmt"
)
const DefaultPrefix = "Grpc"
type Config struct {
Host *string
Port uint
Tls *Tls
}
type Tls struct {
CA string
Cert string
Key string
}
func (h *Config) Address() string {
if h.Host == nil {
return h.PortString()
}
return fmt.Sprintf("%s:%d", *h.Host, h.Port)
}
func (h *Config) PortString() string {
return fmt.Sprintf(":%d", h.Port)
}