Skip to content

Autodetect OWN_PRIVATE_API_URL

OWN_PRIVATE_API_URL environment variable is often causing issues in Omnibus setup because it's difficult to configure it (in Omnibus) for multi-host installations of kas.

Proposal

Introduce new mode of operations:

  1. See if OWN_PRIVATE_API_URL is set. If specified, use it.
  2. Look for OWN_PRIVATE_API_CIDR. If it's set, treat it as CIDR. This can be parsed using net.ParseCIDR(). After successful parsing, look at the available network interfaces. Use the address that matches the CIDR as the own IP address. Report error if multiple addresses match.
  3. Look for OWN_PRIVATE_API_SCHEME. If specified, use it (grpc/grpcs). If not, use grpc.
  4. Look for OWN_PRIVATE_API_PORT. If specified, use it.
  5. If OWN_PRIVATE_API_CIDR is not set, look at the listen address for the private API endpoint. Use the exact IP+port provided unless it's a wildcard "listen-on-all-interfaces" address (0.0.0.0 or ::). OWN_PRIVATE_API_PORT is ignored in this case.
  6. If all of the above fails, abort the program.
Edited by Mikhail Mazurskiy