feat: add timezone configuration support to server settings and Docker image
Build / Build and Push (push) Successful in 45s

This commit is contained in:
2026-06-05 19:57:27 +01:00
parent 07aa8e5ffe
commit 8308950637
4 changed files with 15 additions and 2 deletions
+2 -2
View File
@@ -15,9 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /app/bin/goencode ./cmd/go
# Final stage
FROM debian:bookworm-slim
# Install ffmpeg and ca-certificates
# Install ffmpeg, ca-certificates, and tzdata for timezone support
RUN apt-get update && \
apt-get install -y --no-install-recommends ffmpeg ca-certificates && \
apt-get install -y --no-install-recommends ffmpeg ca-certificates tzdata && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
+2
View File
@@ -46,6 +46,7 @@ services:
# Web Server Configuration
- GOENCODE_SERVER_LISTEN=0.0.0.0
- GOENCODE_SERVER_PORT=8080
- TZ=Europe/London
# Web UI Authentication (Optional)
- GOENCODE_AUTH_USER=admin
@@ -89,6 +90,7 @@ GoEncode can be configured via `goencode.yaml` or entirely via environment varia
| `GOENCODE_DB_NAME` | Database name | `goencode` |
| `GOENCODE_SERVER_LISTEN` | IP to bind the web interface | `0.0.0.0` |
| `GOENCODE_SERVER_PORT` | Port for the web interface | `8080` |
| `TZ` | Container TimeZone | `UTC` |
| `GOENCODE_AUTH_USER` | Username for the web UI | |
| `GOENCODE_AUTH_PASS` | Password for the web UI | |
| `GOENCODE_ENCODER_TEMP`| Temp directory for processing jobs | `/tmp/goencode` |
+1
View File
@@ -1,6 +1,7 @@
server:
port: 8080
listen_addr: "0.0.0.0"
timezone: "UTC"
auth:
username: "admin"
+10
View File
@@ -27,6 +27,7 @@ func getEnvInt(key string, defaultVal int) int {
type ServerConfig struct {
Port int `yaml:"port"`
ListenAddr string `yaml:"listen_addr"`
TimeZone string `yaml:"timezone"`
}
type DatabaseConfig struct {
@@ -95,5 +96,14 @@ func LoadConfig(path string) (*Config, error) {
cfg.Database.Port = 3306
}
if envTZ := os.Getenv("TZ"); envTZ != "" {
cfg.Server.TimeZone = envTZ
}
// Apply timezone if set
if cfg.Server.TimeZone != "" {
os.Setenv("TZ", cfg.Server.TimeZone)
}
return &cfg, nil
}