feat: support CONFIG env variable for file
All checks were successful
build / build (push) Successful in 1m53s
All checks were successful
build / build (push) Successful in 1m53s
This commit is contained in:
parent
7535cd1a1b
commit
97a299fe0b
|
|
@ -25,7 +25,7 @@ RUN pacman -Syu --noconfirm \
|
||||||
python-xattr \
|
python-xattr \
|
||||||
python-pyxattr
|
python-pyxattr
|
||||||
|
|
||||||
COPY <<-EOT /app/config.toml
|
COPY <<-EOT /data/config.toml
|
||||||
dry_run = false
|
dry_run = false
|
||||||
out_dir = "/data/vids"
|
out_dir = "/data/vids"
|
||||||
|
|
||||||
|
|
|
||||||
11
README.md
11
README.md
|
|
@ -48,6 +48,17 @@ E.g. from Chromium:
|
||||||
yt-dlp --cookies-from-browser chromium --cookies cookies.txt
|
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
|
## Result
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
9
main.go
9
main.go
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
"git.meatbag.se/varl/subsyt/internal/config"
|
"git.meatbag.se/varl/subsyt/internal/config"
|
||||||
"git.meatbag.se/varl/subsyt/internal/dl"
|
"git.meatbag.se/varl/subsyt/internal/dl"
|
||||||
|
|
@ -9,7 +10,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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 {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue