Skip to content

Commit

Permalink
Fix url and add node container internal ip (#1477)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-gopalswami authored Dec 12, 2024
1 parent 11410d9 commit 8f36945
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions framework/components/clnode/clnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type NodeOut struct {
HostURL string `toml:"url"`
DockerURL string `toml:"docker_internal_url"`
DockerP2PUrl string `toml:"p2p_docker_internal_url"`
InternalIP string `toml:"internal_ip"`
}

// NewNodeWithDB create a new Chainlink node with some image:tag and one or several configs
Expand Down Expand Up @@ -301,6 +302,10 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
if err != nil {
return nil, err
}
ip, err := c.ContainerIP(ctx)
if err != nil {
return nil, err
}
host, err := framework.GetHost(c)
if err != nil {
return nil, err
Expand All @@ -315,6 +320,7 @@ func newNode(in *Input, pgOut *postgres.Output) (*NodeOut, error) {
HostURL: fmt.Sprintf("http://%s:%s", host, mp.Port()),
DockerURL: fmt.Sprintf("http://%s:%s", containerName, DefaultHTTPPort),
DockerP2PUrl: fmt.Sprintf("http://%s:%s", containerName, DefaultP2PPort),
InternalIP: ip,
}, nil
}

Expand Down
8 changes: 4 additions & 4 deletions framework/components/jd/jd.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ func NewJD(in *Input) (*Output, error) {
}
out := &Output{
UseCache: true,
HostGRPCUrl: fmt.Sprintf("http://%s:%s", host, in.GRPCPort),
DockerGRPCUrl: fmt.Sprintf("http://%s:%s", containerName, in.GRPCPort),
HostWSRPCUrl: fmt.Sprintf("ws://%s:%s", host, in.WSRPCPort),
DockerWSRPCUrl: fmt.Sprintf("ws://%s:%s", containerName, in.WSRPCPort),
HostGRPCUrl: fmt.Sprintf("%s:%s", host, in.GRPCPort),
DockerGRPCUrl: fmt.Sprintf("%s:%s", containerName, in.GRPCPort),
HostWSRPCUrl: fmt.Sprintf("%s:%s", host, in.WSRPCPort),
DockerWSRPCUrl: fmt.Sprintf("%s:%s", containerName, in.WSRPCPort),
}
in.Out = out
return out, nil
Expand Down

0 comments on commit 8f36945

Please sign in to comment.