acs::Cluster method qualified_location (public)
<instance of acs::Cluster> qualified_location location
Defined in packages/acs-tcl/tcl/cluster-procs.tcl
Return a canonical representation of the provided location, where the DNS name is resolved and the protocol and port is always included. When there is no protocol provided, HTTP is assumed. Provide defaults, when no port is included in the passed-in location. Note, that there is no default provided for non-HTTP* locations, so these must contain the port.
- Parameters:
- location (required)
- Testcases:
- No testcase defined.
Source code: set d {port 80 proto http} if {[regexp {^([^:]+)://} $location . proto]} { if {$proto eq "https"} { set d {port 443 proto https} } set d [dict merge $d [ns_parseurl $location]] dict unset d tail dict unset d path } else { set d [dict merge $d [ns_parsehostport $location]] } set label [dict get $d port]/tcp set containerMapping [acs::container mapping] # catch { # ns_log notice "check container mapping for $label: $d" # ns_log notice "... internal?[expr {[dict get $d host] eq {host.docker.internal}}]" # ns_log notice "... mapping? [expr {$containerMapping ne {}}]" # ns_log notice "... label? [dict exists $containerMapping $label]" # ns_log notice "... port= [dict get $containerMapping $label port]" # } if {$containerMapping ne "" && [dict get $d host] eq "host.docker.internal" && [dict exists $containerMapping $label] && [dict get $containerMapping $label port] < 32768 } { # Ephemeral ports on Linux are typically 32768-60999 # https://en.wikipedia.org/wiki/Ephemeral_port #ns_log notice "... there is a container mapping for $d -> [dict get $containerMapping $label]" set d [dict get $containerMapping $label] } else { # # In theory, an input location might map to multiple # values, when e.g., a provided DNS name refers to # multiple IP addresses. For now, we just return always a # single value. # # To return all IP addresses, we could use "ns_addrbyhost # -all ..." instead. # dict set d host [ns_addrbyhost [dict get $d host]] } set d [:map_inaddr_any -dict $d] dict with d { set result [util::join_location -noabbrev -proto $proto -hostname $host -port $port] } return $resultXQL Not present: Generic, PostgreSQL, Oracle