Files
threshold/internal/daemon/worker/proxy/options.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
883 B
Go
Raw Normal View History

package proxy
import (
2021-12-17 11:26:42 -08:00
serverpb "github.com/hashicorp/boundary/internal/gen/controller/servers/services"
)
// Option - how Options are passed as arguments.
type Option func(*Options)
// GetOpts - iterate the inbound Options and return a struct.
func GetOpts(opt ...Option) Options {
opts := getDefaultOptions()
for _, o := range opt {
o(&opts)
}
return opts
}
// Options = how options are represented
type Options struct {
WithInjectedApplicationCredentials []*serverpb.Credential
}
func getDefaultOptions() Options {
return Options{
WithInjectedApplicationCredentials: nil,
}
}
// WithInjectedApplicationCredentials provides an optional injected application
// credentials to use when establishing a proxy
func WithInjectedApplicationCredentials(creds []*serverpb.Credential) Option {
return func(o *Options) {
o.WithInjectedApplicationCredentials = creds
}
}