Skip to content

Commit

Permalink
provide port param
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Nov 7, 2024
1 parent d70a469 commit 9cc0f6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion framework/components/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const (

type Input struct {
Image string `toml:"image" validate:"required"`
Port string `toml:"port"`
Databases int `toml:"databases"`
PullImage bool `toml:"pull_image"`
Out *Output `toml:"out"`
Expand Down Expand Up @@ -95,12 +96,18 @@ func NewPostgreSQL(in *Input) (*Output, error) {
WithStartupTimeout(20 * time.Second).
WithPollInterval(1 * time.Second),
}
var port string
if in.Port != "" {
port = in.Port
} else {
port = ExposedStaticPort
}
req.HostConfigModifier = func(h *container.HostConfig) {
h.PortBindings = nat.PortMap{
nat.Port(bindPort): []nat.PortBinding{
{
HostIP: "0.0.0.0",
HostPort: fmt.Sprintf("%s/tcp", ExposedStaticPort),
HostPort: fmt.Sprintf("%s/tcp", port),
},
},
}
Expand Down
1 change: 1 addition & 0 deletions framework/components/simple_node_set/nodeset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func TestDockerNodeSetSharedDB(t *testing.T) {
DataProviderURL: "http://example.com",
DbInput: &postgres.Input{
Image: "postgres:15.6",
Port: "14000",
},
Node: &clnode.NodeInput{
Image: "public.ecr.aws/chainlink/chainlink:v2.17.0",
Expand Down

0 comments on commit 9cc0f6a

Please sign in to comment.