Skip to content

Commit

Permalink
Fixed for support of actuators
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDigitalEagle committed Nov 15, 2022
1 parent 0a52fcc commit 47203e2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ $cf create-service config-server default test-service -c "whatever json configur

## History ##

* v1.0.0 - Full release with support for SR Actuators
* v0.0.5 - Services as configurable objects
* v0.0.4 - Now with configurable package names
* v0.0.3 - Now without package fetching
Expand Down
4 changes: 2 additions & 2 deletions broker/create_registry_server_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (broker *SCSBroker) createRegistryServerInstance(serviceId string, instance

for _, stat := range stats {

rc.AddPeer(stat.Index, "http", stat.Host, stat.InstancePorts[0].External)
rc.AddPeer(stat.Index, fmt.Sprintf("http://%s:%d/eureka", stat.Host, stat.InstancePorts[0].External), serviceId)
}
} else {
rc.Standalone()
Expand Down Expand Up @@ -220,7 +220,7 @@ func (broker *SCSBroker) createRegistryServerInstance(serviceId string, instance
}

for _, stat := range stats {
rc.AddPeer(stat.Index, "http", stat.Host, stat.InstancePorts[0].External)
rc.AddPeer(stat.Index, fmt.Sprintf("http://%s:%d/eureka", stat.Host, stat.InstancePorts[0].External), serviceId)
}
}

Expand Down
2 changes: 1 addition & 1 deletion broker/update_registry_server_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (broker *SCSBroker) updateRegistryServerInstance(cxt context.Context, insta
}

for _, stat := range stats {
rc.AddPeer(stat.Index, "http", stat.Host, stat.InstancePorts[0].External)
rc.AddPeer(stat.Index, fmt.Sprintf("http://%s:%d/eureka", stat.Host, stat.InstancePorts[0].External), details.ServiceID)
}
}

Expand Down
12 changes: 6 additions & 6 deletions broker/utilities/registry_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ func NewRegistryConfig() *RegistryConfig {
}

type RegistryPeer struct {
Index int `json:"index"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Port int `json:"port"`
Index int `json:"index"`
Count int `json:"nodeCount"`
URI string `json:"uri"`
ServiceInstanceId string `json:"service-instance-id"`
}

type RegistryConfig struct {
Mode string
Peers []*RegistryPeer
}

func (rc *RegistryConfig) AddPeer(idx int, scheme string, host string, port int) {
rc.Peers = append(rc.Peers, &RegistryPeer{Index: idx, Scheme: scheme, Host: host, Port: port})
func (rc *RegistryConfig) AddPeer(idx int, uri string, serviceinstanceID string) {
rc.Peers = append(rc.Peers, &RegistryPeer{Index: idx, Count: idx, URI: uri, ServiceInstanceId: serviceinstanceID})
}

func (rc *RegistryConfig) Standalone() {
Expand Down

0 comments on commit 47203e2

Please sign in to comment.