forked from harness/gitness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opts.go
37 lines (31 loc) · 846 Bytes
/
opts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package web
import "time"
// Options defines website handler options.
type Options struct {
sync time.Duration
path string
docs string
}
// Option configures the website handler.
type Option func(*Options)
// WithSync configures the website hanlder with the duration value
// used to determine if the user account requires synchronization.
func WithSync(d time.Duration) Option {
return func(o *Options) {
o.sync = d
}
}
// WithDir configures the website hanlder with the directory value
// used to serve the website from the local filesystem.
func WithDir(s string) Option {
return func(o *Options) {
o.path = s
}
}
// WithDocs configures the website hanlder with the documentation
// website address, which should be included in the user interface.
func WithDocs(s string) Option {
return func(o *Options) {
o.docs = s
}
}