소스 검색

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 <noreply@anthropic.com>
master
Jan Svabenik 1 개월 전
부모
커밋
3f1e245774
2개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. +2
    -1
      config.yaml.example
  2. +5
    -3
      internal/server/server.go

+ 2
- 1
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.


+ 5
- 3
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)
}



불러오는 중...
취소
저장