Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDN-???: Support internal host names in PCI #192

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/main/scala/io/flow/util/clients/Registry.scala
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,24 @@ class ProductionRegistry() extends Registry {
publicHost
} else {
Try {
Await.result(asyncDnsLookupByName(applicationId), RegistryConstants.DnsLookupWaitTime)
}.fold(_ => publicHost, _ => s"http://$applicationId")
val future = Future.find(Seq(
asyncDnsLookupByName(applicationId),
asyncDnsLookupByName(s"$applicationId.$applicationId"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make the namespace ID configurable?
We run same service payment in 2 different namespaces to avoid coupling stuff and minimise impact.
It would be better if we could configure the namespace Id and all the call within one cluster will go to the same service, which is the default one.

asyncDnsLookupByName(s"$applicationId.production"),
))(_ => true)
Await.result(future, RegistryConstants.DnsLookupWaitTime)
}.toOption.flatten.fold(publicHost)(localHost => s"http://$localHost")
}

RegistryConstants.log("Production", applicationId, s"host[$host]")
host
}

protected def asyncDnsLookupByName(name: String): Future[Unit] = {
protected def asyncDnsLookupByName(name: String): Future[String] = {
Future {
InetAddress.getByName(name)
}.map(_ => ())
name
}
}
}

Expand Down