William Petit
d5fed4c2ac
Some checks reported errors
Cadoles/bouncer/pipeline/head Something is wrong with the build of this commit
ref CNOUS/mse#3907
34 lines
499 B
Go
34 lines
499 B
Go
package authn
|
|
|
|
type Options struct {
|
|
TemplateDir string
|
|
Debug bool
|
|
}
|
|
|
|
type OptionFunc func(*Options)
|
|
|
|
func NewOptions(funcs ...OptionFunc) *Options {
|
|
opts := &Options{
|
|
TemplateDir: "./templates",
|
|
Debug: false,
|
|
}
|
|
|
|
for _, fn := range funcs {
|
|
fn(opts)
|
|
}
|
|
|
|
return opts
|
|
}
|
|
|
|
func WithTemplateDir(templateDir string) OptionFunc {
|
|
return func(o *Options) {
|
|
o.TemplateDir = templateDir
|
|
}
|
|
}
|
|
|
|
func WithDebug(debug bool) OptionFunc {
|
|
return func(o *Options) {
|
|
o.Debug = debug
|
|
}
|
|
}
|