Skip to content

Commit

Permalink
feat: add hostname to default device name
Browse files Browse the repository at this point in the history
This makes it easier to distinguish different instances of go-librespot
on different devices.

The error is intenionally ignored: in the unlikely case that
os.Hostname() can't provide a hostname, there's no real problem and we
just use the old behavior of not providing the hostname.
  • Loading branch information
aykevl authored and devgianlu committed Sep 10, 2024
1 parent 79bfa60 commit efe81ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ func loadConfig(cfg *Config) error {
if cfg.DeviceName == nil {
cfg.DeviceName = new(string)
*cfg.DeviceName = "go-librespot"
hostname, _ := os.Hostname()
if hostname != "" {
*cfg.DeviceName += " " + hostname
}
}
if cfg.Credentials.Type == "" {
cfg.Credentials.Type = "zeroconf"
Expand Down

0 comments on commit efe81ed

Please sign in to comment.