feat: support CONFIG env variable for file
All checks were successful
build / build (push) Successful in 1m53s

This commit is contained in:
Viktor Varland 2025-03-29 09:48:23 +01:00
parent 7535cd1a1b
commit 97a299fe0b
Signed by: varl
GPG key ID: 7459F0B410115EE8
3 changed files with 20 additions and 2 deletions

View file

@ -25,7 +25,7 @@ RUN pacman -Syu --noconfirm \
python-xattr \
python-pyxattr
COPY <<-EOT /app/config.toml
COPY <<-EOT /data/config.toml
dry_run = false
out_dir = "/data/vids"

View file

@ -48,6 +48,17 @@ E.g. from Chromium:
yt-dlp --cookies-from-browser chromium --cookies cookies.txt
```
## Container
```
podman run --rm \
--env='CONFIG=/data/config.toml' \
--volume=path/to/config:/data/config.toml \
--volume=path/to/opml:/data/opml.xml \
--volume=path/to/cookies:/data/cookies.txt
registry.meatbag.se/varl/subsyt
```
## Result
```

View file

@ -2,6 +2,7 @@ package main
import (
"log"
"os"
"git.meatbag.se/varl/subsyt/internal/config"
"git.meatbag.se/varl/subsyt/internal/dl"
@ -9,7 +10,13 @@ import (
)
func main() {
cfg, err := config.Load("./config.toml")
configPath := os.Getenv("CONFIG")
if configPath == "" {
configPath = "./config.toml"
}
cfg, err := config.Load(configPath)
if err != nil {
panic(err)
}