Files
ctrld/internal/controld/hostname_others.go
T
Codescribe 56b3ee19c1 fix: include hostname hints in metadata for API-side fallback
Send all available hostname sources (ComputerName, LocalHostName,
HostName, os.Hostname) in the metadata map when provisioning.
This allows the API to detect and repair generic hostnames like
'Mac' by picking the best available source server-side.

Belt and suspenders: preferredHostname() picks the right one
client-side, but metadata gives the API a second chance.
2026-03-05 17:24:03 +07:00

20 lines
433 B
Go

//go:build !darwin
package controld
import "os"
// preferredHostname returns the system hostname on non-Darwin platforms.
func preferredHostname() (string, error) {
return os.Hostname()
}
// hostnameHints returns available hostname sources for diagnostic purposes.
func hostnameHints() map[string]string {
hints := make(map[string]string)
if h, err := os.Hostname(); err == nil {
hints["os.Hostname"] = h
}
return hints
}