service: replace cmd with NewFlagSet, add internal service version metadata interceptors

client: add NewFlagSet, add missing Options interface methods

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2022-03-10 12:46:36 +01:00
parent e578d62a29
commit c0e79d8834
10 changed files with 597 additions and 159 deletions

View File

@ -61,6 +61,7 @@ type Options interface {
Address() string
Reflection() bool
Health() bool
CACert() string
Cert() string
@ -103,6 +104,7 @@ func NewOptions() *options {
return &options{
ctx: context.Background(),
address: ":0",
health: true,
}
}
@ -161,6 +163,12 @@ func WithReflection(r bool) Option {
}
}
func WithHealth(h bool) Option {
return func(o *options) {
o.health = h
}
}
func WithSecure(s bool) Option {
return func(o *options) {
o.secure = s
@ -351,6 +359,7 @@ type options struct {
address string
reflection bool
health bool
secure bool
caCert string
@ -413,6 +422,10 @@ func (o *options) Reflection() bool {
return o.reflection
}
func (o *options) Health() bool {
return o.health
}
func (o *options) CACert() string {
return o.caCert
}