-
Notifications
You must be signed in to change notification settings - Fork 31
/
config.go
53 lines (43 loc) · 906 Bytes
/
config.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package faucet
// Option is a function that applies configs to a Config Object
type Option = func(c *Config)
// Config holds the properties that configure the package
type Config struct {
tenNodeHost string
tenNodePort int
faucetPort int
faucetPrivKey string
dockerImage string
}
func NewFaucetConfig(opts ...Option) *Config {
defaultConfig := &Config{}
for _, opt := range opts {
opt(defaultConfig)
}
return defaultConfig
}
func WithTenNodeHost(s string) Option {
return func(c *Config) {
c.tenNodeHost = s
}
}
func WithFaucetPrivKey(s string) Option {
return func(c *Config) {
c.faucetPrivKey = s
}
}
func WithDockerImage(s string) Option {
return func(c *Config) {
c.dockerImage = s
}
}
func WithTenNodePort(i int) Option {
return func(c *Config) {
c.tenNodePort = i
}
}
func WithFaucetPort(i int) Option {
return func(c *Config) {
c.faucetPort = i
}
}