Skip to content

Commit

Permalink
Fixes hard-coded nats instance ID, addresses issue 46 reported (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
reneighbor authored Jul 26, 2022
1 parent 3f48787 commit c84aab7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions jobs/nats-tls/templates/migrator-config.json.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<%
nats_instances = []
nats_hostname = ''
nats_port = nil
nats_migrate_port = 4243
if_link("nats-tls") do |nats_tls_link|
nats_hostname = nats_tls_link.p("nats.hostname")
nats_port = nats_tls_link.p("nats.port")
nats_tls_link.instances.map do |instance|
nats_instances.push("#{instance.id}.#{nats_tls_link.p("nats.hostname")}")
nats_instances.push("#{instance.id}.#{nats_hostname}")
end
end
%>
{
"bootstrap": <%= spec.bootstrap %>,
"address": <%= "\"#{spec.id}.nats.service.cf.internal\"" %>,
"address": <%= "\"#{spec.id}.#{nats_hostname}\"" %>,
"nats_instances": [ <%= nats_instances.map { |e| "\"#{e}:#{nats_port}\""}.join(", ") %> ],
"nats_port": <%= nats_port %>,
"nats_migrate_port": <%= nats_migrate_port %>,
Expand Down
6 changes: 4 additions & 2 deletions jobs/nats/templates/migrator-config.json.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<%
nats_instances = []
nats_hostname = ''
nats_port = nil
nats_migrate_port = 4242
if_link("nats") do |nats_link|
nats_port = nats_link.p("nats.port")
nats_hostname = nats_link.p("nats.hostname")
nats_link.instances.map do |instance|
nats_instances.push("#{instance.id}.#{nats_link.p("nats.hostname")}")
nats_instances.push("#{instance.id}.#{nats_hostname}")
end
end
%>
{
"bootstrap": <%= spec.bootstrap %>,
"address": <%= "\"#{spec.id}.nats.service.cf.internal\"" %>,
"address": <%= "\"#{spec.id}.#{nats_hostname}\"" %>,
"nats_instances": [ <%= nats_instances.map { |e| "\"#{e}:#{nats_port}\""}.join(", ") %> ],
"nats_port": <%= nats_port %>,
"nats_migrate_port": <%= nats_migrate_port %>,
Expand Down

0 comments on commit c84aab7

Please sign in to comment.