mirror of
https://github.com/glauth/glauth.git
synced 2026-10-25 21:49:50 +00:00
1b92cfbae6
Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: Zhou Wenzong <wenzong@users.noreply.github.com> Co-authored-by: Jairo Llopis <Yajo@users.noreply.github.com> Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: Nicolai Willems <172633+nwillems@users.noreply.github.com> Co-authored-by: Thibault Soubiran <soubi.thibault@gmail.com> Co-authored-by: Clement JACOB <clems71@gmail.com> Co-authored-by: Lutz Horn <code@lhorn.de> Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com> Co-authored-by: Peter Heise <pheise@koprolalie.com> Co-authored-by: Ben Yanke <ben@benyanke.com> Co-authored-by: Chris F Ravenscroft <chris@voilaweb.com> Co-authored-by: fanlix <fanlix@gmail.com>
51 lines
945 B
Go
51 lines
945 B
Go
package frontend
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/glauth/glauth/pkg/config"
|
|
"github.com/go-logr/logr"
|
|
)
|
|
|
|
// Option defines a single option function.
|
|
type Option func(o *Options)
|
|
|
|
// Options defines the available options for this package.
|
|
type Options struct {
|
|
Logger logr.Logger
|
|
Config *config.API
|
|
Context context.Context
|
|
}
|
|
|
|
// newOptions initializes the available default options.
|
|
func newOptions(opts ...Option) Options {
|
|
opt := Options{}
|
|
|
|
for _, o := range opts {
|
|
o(&opt)
|
|
}
|
|
|
|
return opt
|
|
}
|
|
|
|
// Logger provides a function to set the logger option.
|
|
func Logger(val logr.Logger) Option {
|
|
return func(o *Options) {
|
|
o.Logger = val
|
|
}
|
|
}
|
|
|
|
// Config provides a function to set the config option.
|
|
func Config(val *config.API) Option {
|
|
return func(o *Options) {
|
|
o.Config = val
|
|
}
|
|
}
|
|
|
|
// Context provides a function to set the context option.
|
|
func Context(val context.Context) Option {
|
|
return func(o *Options) {
|
|
o.Context = val
|
|
}
|
|
}
|