renamed some config options

This commit is contained in:
Dmitrii Andreev
2025-04-13 08:15:23 +03:00
parent 71ede6e93d
commit 6ca796efb6
4 changed files with 15 additions and 15 deletions

View File

@@ -12,8 +12,8 @@ type Config struct {
CheckInterval time.Duration `mapstructure:"CHECK_INTERVAL"`
RecordingsPath string `mapstructure:"RECORDINGS_PATH"`
TempPath string `mapstructure:"TEMP_PATH"`
ServerAddress string `mapstructure:"SERVER_ADDRESS"`
RSSFeedURL string `mapstructure:"RSS_FEED_URL"`
BindAddress string `mapstructure:"BIND_ADDRESS"`
PublicUrl string `mapstructure:"PUBLIC_URL"`
LogLevel string `mapstructure:"LOG_LEVEL"`
}
@@ -28,8 +28,8 @@ func LoadConfig() (*Config, error) {
"CHECK_INTERVAL": "1m",
"RECORDINGS_PATH": "./recordings",
"TEMP_PATH": "/tmp",
"SERVER_ADDRESS": ":8080",
"RSS_FEED_URL": "http://localhost:8080/rss",
"BIND_ADDRESS": ":8080",
"PUBLIC_URL": "http://localhost:8080",
"LOG_LEVEL": "info",
}

View File

@@ -35,7 +35,7 @@ type Generator struct {
// New creates a new RSS Generator instance
func New(cfg *config.Config, title, description, streamName string) *Generator {
baseURL := cfg.RSSFeedURL
baseURL := cfg.PublicUrl
if baseURL == "" {
slog.Warn("RSS_FEED_URL not set, using default")
baseURL = "http://localhost:8080/recordings/"

View File

@@ -45,7 +45,7 @@ func New(cfg *config.Config, rssGenerator *rss.Generator) *Server {
// Configure server with sensible timeouts
s.server = &http.Server{
Addr: cfg.ServerAddress,
Addr: cfg.BindAddress,
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
@@ -56,7 +56,7 @@ func New(cfg *config.Config, rssGenerator *rss.Generator) *Server {
}
// handleRSS generates and serves the RSS feed
func (s *Server) handleRSS(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleRSS(w http.ResponseWriter, _ *http.Request) {
slog.Debug("Serving RSS feed")
const maxItems = 50