From 97a299fe0b309a9c67fe0c1eefdc4a61540bdc5c Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Sat, 29 Mar 2025 09:48:23 +0100 Subject: [PATCH] feat: support CONFIG env variable for file --- Containerfile | 2 +- README.md | 11 +++++++++++ main.go | 9 ++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index c7a7a27..b214ab1 100644 --- a/Containerfile +++ b/Containerfile @@ -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" diff --git a/README.md b/README.md index 97d2e34..4b477fa 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/main.go b/main.go index 324d80e..866acd4 100644 --- a/main.go +++ b/main.go @@ -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) }