Skip to content

Commit 9cc0f6a

Browse files
committed
provide port param
1 parent d70a469 commit 9cc0f6a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

framework/components/postgres/postgres.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const (
2424

2525
type Input struct {
2626
Image string `toml:"image" validate:"required"`
27+
Port string `toml:"port"`
2728
Databases int `toml:"databases"`
2829
PullImage bool `toml:"pull_image"`
2930
Out *Output `toml:"out"`
@@ -95,12 +96,18 @@ func NewPostgreSQL(in *Input) (*Output, error) {
9596
WithStartupTimeout(20 * time.Second).
9697
WithPollInterval(1 * time.Second),
9798
}
99+
var port string
100+
if in.Port != "" {
101+
port = in.Port
102+
} else {
103+
port = ExposedStaticPort
104+
}
98105
req.HostConfigModifier = func(h *container.HostConfig) {
99106
h.PortBindings = nat.PortMap{
100107
nat.Port(bindPort): []nat.PortBinding{
101108
{
102109
HostIP: "0.0.0.0",
103-
HostPort: fmt.Sprintf("%s/tcp", ExposedStaticPort),
110+
HostPort: fmt.Sprintf("%s/tcp", port),
104111
},
105112
},
106113
}

framework/components/simple_node_set/nodeset_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func TestDockerNodeSetSharedDB(t *testing.T) {
8787
DataProviderURL: "http://example.com",
8888
DbInput: &postgres.Input{
8989
Image: "postgres:15.6",
90+
Port: "14000",
9091
},
9192
Node: &clnode.NodeInput{
9293
Image: "public.ecr.aws/chainlink/chainlink:v2.17.0",

0 commit comments

Comments
 (0)