mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-04-20 00:36:37 +02:00
56b3ee19c1
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.
20 lines
433 B
Go
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
|
|
}
|