feat: add timezone configuration support to server settings and Docker image
Build / Build and Push (push) Successful in 45s
Build / Build and Push (push) Successful in 45s
This commit is contained in:
+2
-2
@@ -15,9 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /app/bin/goencode ./cmd/go
|
|||||||
# Final stage
|
# Final stage
|
||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
# Install ffmpeg and ca-certificates
|
# Install ffmpeg, ca-certificates, and tzdata for timezone support
|
||||||
RUN apt-get update && \
|
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/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ services:
|
|||||||
# Web Server Configuration
|
# Web Server Configuration
|
||||||
- GOENCODE_SERVER_LISTEN=0.0.0.0
|
- GOENCODE_SERVER_LISTEN=0.0.0.0
|
||||||
- GOENCODE_SERVER_PORT=8080
|
- GOENCODE_SERVER_PORT=8080
|
||||||
|
- TZ=Europe/London
|
||||||
|
|
||||||
# Web UI Authentication (Optional)
|
# Web UI Authentication (Optional)
|
||||||
- GOENCODE_AUTH_USER=admin
|
- 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_DB_NAME` | Database name | `goencode` |
|
||||||
| `GOENCODE_SERVER_LISTEN` | IP to bind the web interface | `0.0.0.0` |
|
| `GOENCODE_SERVER_LISTEN` | IP to bind the web interface | `0.0.0.0` |
|
||||||
| `GOENCODE_SERVER_PORT` | Port for the web interface | `8080` |
|
| `GOENCODE_SERVER_PORT` | Port for the web interface | `8080` |
|
||||||
|
| `TZ` | Container TimeZone | `UTC` |
|
||||||
| `GOENCODE_AUTH_USER` | Username for the web UI | |
|
| `GOENCODE_AUTH_USER` | Username for the web UI | |
|
||||||
| `GOENCODE_AUTH_PASS` | Password for the web UI | |
|
| `GOENCODE_AUTH_PASS` | Password for the web UI | |
|
||||||
| `GOENCODE_ENCODER_TEMP`| Temp directory for processing jobs | `/tmp/goencode` |
|
| `GOENCODE_ENCODER_TEMP`| Temp directory for processing jobs | `/tmp/goencode` |
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8080
|
||||||
listen_addr: "0.0.0.0"
|
listen_addr: "0.0.0.0"
|
||||||
|
timezone: "UTC"
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
username: "admin"
|
username: "admin"
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ func getEnvInt(key string, defaultVal int) int {
|
|||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
Port int `yaml:"port"`
|
Port int `yaml:"port"`
|
||||||
ListenAddr string `yaml:"listen_addr"`
|
ListenAddr string `yaml:"listen_addr"`
|
||||||
|
TimeZone string `yaml:"timezone"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DatabaseConfig struct {
|
type DatabaseConfig struct {
|
||||||
@@ -95,5 +96,14 @@ func LoadConfig(path string) (*Config, error) {
|
|||||||
cfg.Database.Port = 3306
|
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
|
return &cfg, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user