From 3f1e245774dd6a65fe55bf587dae5194079426c3 Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Mon, 25 May 2026 21:19:11 +0200 Subject: [PATCH] configurable bind address + default port 8889 - Add host field to Config (default 0.0.0.0) - Change default port from 8080 to 8889 - Listen on host:port instead of :port Co-Authored-By: Claude Sonnet 4.6 --- config.yaml.example | 3 ++- internal/server/server.go | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config.yaml.example b/config.yaml.example index 89a8599..a3244e6 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -1,4 +1,5 @@ -port: 8080 +host: "0.0.0.0" # bind address; use 127.0.0.1 to restrict to localhost +port: 8889 # Optional: full path to winamp.exe — only needed if you want roadamp to # launch Winamp for you. Leave empty (or omit) if you start Winamp yourself. diff --git a/internal/server/server.go b/internal/server/server.go index a5b689e..09a23c7 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -28,6 +28,7 @@ import ( // ── Config ──────────────────────────────────────────────────────────────────── type Config struct { + Host string `yaml:"host"` Port int `yaml:"port"` WinampPath string `yaml:"winamp_path"` KillListFile string `yaml:"killist_file"` @@ -36,7 +37,8 @@ type Config struct { func loadConfig(path string) (Config, error) { cfg := Config{ - Port: 8080, + Host: "0.0.0.0", + Port: 8889, KillListFile: "killist.dat", ResumeFile: "resume.dat", } @@ -83,8 +85,8 @@ func (s *Server) Run() error { go s.restoreResume() go s.killChecker() - addr := fmt.Sprintf(":%d", s.cfg.Port) - log.Printf("roadamp listening on http://localhost%s", addr) + addr := fmt.Sprintf("%s:%d", s.cfg.Host, s.cfg.Port) + log.Printf("roadamp listening on http://%s", addr) return http.ListenAndServe(addr, s.mux) }