mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-29 00:21:52 -05:00
* feat(start): add --bind to publish the port on one host address start published the API port with no host address, so it went on every interface unless the runtime's default was changed, and the CLI had no option to choose the address. --bind ADDR publishes it on that address; on AWS it also sets FLOCI_SERVICES_UI_BIND_ADDRESS so the web console follows. It is also a profile key and a config profile create flag. The address is parsed as one IP literal and passed on in one form, IPv4 dotted and IPv6 in full, so docker and podman only see a form they read. A value that is not an IP literal, an IPv6 zone or IPv4 not written dotted is refused with exit 2, before restart stops anything. The CLI still connects to 127.0.0.1, so any address but 127.0.0.1 or 0.0.0.0 also needs --endpoint. start records the address in a floci_bind label, and restart keeps it, from the profile or else from that label. A container without the label restarts without --bind: the addresses a runtime reports also hold its own defaults (Podman's 0.0.0.0, default_host_ips), so they are not read back. Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com> * fix(start): probe the --bind address in the port check The port check before start bound the wildcard address. Linux refuses that while another socket holds the port on 127.0.0.1, so start --bind with a LAN address exited 1 on that port although the address was free. With --bind the check now binds that address. When that works, the port is free only if nothing answers there, since macOS and Windows let the bind share the port with a listener on the wildcard. When it fails, a bind on port 0 tells whether this machine has the address at all (the error text cannot: Linux translates it). If it does not, docker judges the address. If it does, the old rule decides, and below 1024 it asks whether something answers on that address instead of on loopback. Without --bind, or with --bind 0.0.0.0 or ::, the check is unchanged. Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com> --------- Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>