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

@@ -44,13 +44,13 @@ go build -o icecast-ripper ./cmd/icecast-ripper/main.go
Icecast Ripper is configured through environment variables:
| Environment Variable | Description | Default | Required |
|---------------------|-------------|---------|----------|
|----------------------|-------------|---------|----------|
| `STREAM_URL` | URL of the Icecast stream to monitor | - | Yes |
| `CHECK_INTERVAL` | Interval between stream checks (e.g., 1m, 30s) | 1m | No |
| `RECORDINGS_PATH` | Path where recordings are stored | ./recordings | No |
| `TEMP_PATH` | Path for temporary files | ./temp | No |
| `SERVER_ADDRESS` | Address and port for the HTTP server | :8080 | No |
| `RSS_FEED_URL` | Public URL for the RSS feed | <http://localhost:8080/rss> | No |
| `BIND_ADDRESS` | Address and port for the HTTP server | :8080 | No |
| `PUBLIC_URL` | Public URL for the RSS feed | <http://localhost:8080> | No |
| `LOG_LEVEL` | Logging level (debug, info, warn, error) | info | No |
## Docker Compose

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