-
Notifications
You must be signed in to change notification settings - Fork 116
/
options.go
68 lines (54 loc) · 1.75 KB
/
options.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package relayer
import (
"github.com/strangelove-ventures/interchaintest/v5/ibc"
)
// RelayerOption is used to customize the relayer configuration, whether constructed with the
// RelayerFactory or with the more specific NewDockerRelayer or NewCosmosRelayer methods.
type RelayerOption interface {
// relayerOption is a no-op to be more restrictive on what types can be used as RelayerOptions
relayerOption()
}
type RelayerOptions []RelayerOption
type RelayerOptionDockerImage struct {
DockerImage ibc.DockerImage
}
// RelayerOptionHomeDir allows the configuration of the relayer home directory.
type RelayerOptionHomeDir struct {
HomeDir string
}
func (r RelayerOptionHomeDir) relayerOption() {}
// CustomDockerImage overrides the default relayer docker image.
// uidGid is the uid:gid format owner that should be used within the container.
// If uidGid is empty, root user will be assumed.
func CustomDockerImage(repository string, version string, uidGid string) RelayerOption {
return RelayerOptionDockerImage{
DockerImage: ibc.DockerImage{
Repository: repository,
Version: version,
UidGid: uidGid,
},
}
}
func HomeDir(homeDir string) RelayerOption {
return RelayerOptionHomeDir{HomeDir: homeDir}
}
func (opt RelayerOptionDockerImage) relayerOption() {}
type RelayerOptionImagePull struct {
Pull bool
}
func ImagePull(pull bool) RelayerOption {
return RelayerOptionImagePull{
Pull: pull,
}
}
func (opt RelayerOptionImagePull) relayerOption() {}
type RelayerOptionExtraStartFlags struct {
Flags []string
}
// StartupFlags appends additional flags when starting the relayer.
func StartupFlags(flags ...string) RelayerOption {
return RelayerOptionExtraStartFlags{
Flags: flags,
}
}
func (opt RelayerOptionExtraStartFlags) relayerOption() {}