Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ services:
- UN_WEBSERVER_URLBASE=/
- UN_WEBSERVER_UPSTREAMS=
## Folder Settings
- UN_FOLDERS_INTERVAL=0s
- UN_FOLDERS_INTERVAL=1s
- UN_FOLDERS_BUFFER=20000
## Sonarr Settings
- UN_SONARR_0_URL=http://127.0.0.1:8989
- UN_SONARR_0_URL=http://sonarr:8989
- UN_SONARR_0_API_KEY=0123456789abcdef0123456789abcdef
- UN_SONARR_0_PATHS_0=/downloads
- UN_SONARR_0_PROTOCOLS=torrent
Expand All @@ -62,7 +62,7 @@ services:
- UN_SONARR_0_DELETE_ORIG=false
- UN_SONARR_0_SYNCTHING=false
## Radarr Settings
- UN_RADARR_0_URL=http://127.0.0.1:7878
- UN_RADARR_0_URL=http://radarr:7878
- UN_RADARR_0_API_KEY=0123456789abcdef0123456789abcdef
- UN_RADARR_0_PATHS_0=/downloads
- UN_RADARR_0_PROTOCOLS=torrent
Expand All @@ -71,7 +71,7 @@ services:
- UN_RADARR_0_DELETE_ORIG=false
- UN_RADARR_0_SYNCTHING=false
## Lidarr Settings
- UN_LIDARR_0_URL=http://127.0.0.1:8686
- UN_LIDARR_0_URL=http://lidarr:8686
- UN_LIDARR_0_API_KEY=0123456789abcdef0123456789abcdef
- UN_LIDARR_0_PATHS_0=/downloads
- UN_LIDARR_0_PROTOCOLS=torrent
Expand All @@ -80,7 +80,7 @@ services:
- UN_LIDARR_0_DELETE_ORIG=false
- UN_LIDARR_0_SYNCTHING=false
## Readarr Settings
- UN_READARR_0_URL=http://127.0.0.1:8787
- UN_READARR_0_URL=http://readarr:8787
- UN_READARR_0_API_KEY=0123456789abcdef0123456789abcdef
- UN_READARR_0_PATHS_0=/downloads
- UN_READARR_0_PROTOCOLS=torrent
Expand All @@ -89,7 +89,7 @@ services:
- UN_READARR_0_DELETE_ORIG=false
- UN_READARR_0_SYNCTHING=false
## Whisparr Settings
- UN_WHISPARR_0_URL=http://127.0.0.1:6969
- UN_WHISPARR_0_URL=http://whisparr:6969
- UN_WHISPARR_0_API_KEY=0123456789abcdef0123456789abcdef
- UN_WHISPARR_0_PATHS_0=/downloads
- UN_WHISPARR_0_PROTOCOLS=torrent
Expand Down Expand Up @@ -135,4 +135,4 @@ services:
- UN_CMDHOOK_0_EXCLUDE_1=lidarr
- UN_CMDHOOK_0_TIMEOUT=10s

## => Content Auto Generated, 31 JUL 2024 17:36 UTC
## => Content Auto Generated, 02 AUG 2024 02:13 UTC
2 changes: 1 addition & 1 deletion examples/unpackerr.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,4 @@ dir_mode = "0755"
## You can adjust how long to wait for the command to run.
# timeout = "10s"

## => Content Auto Generated, 31 JUL 2024 17:36 UTC
## => Content Auto Generated, 02 AUG 2024 02:13 UTC
8 changes: 5 additions & 3 deletions init/config/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ func (h *Header) makeComposeDefined(prefix string, defs Defs, order []section, b
}

func (p *Param) Compose(prefix string) string {
val := p.Default
if p.Example != nil {
val = p.Example
val := p.Example
if p.Docker != nil {
val = p.Docker
} else if val == nil {
val = p.Default
}

switch p.Kind {
Expand Down
21 changes: 16 additions & 5 deletions init/config/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,33 +157,43 @@ defs:
text: |
## Leaving the [[sonarr]] header uncommented (no leading hash #) without also
## uncommenting the api_key (remove the hash #) will produce a startup warning.
defaults:
docker_example:
url: http://sonarr:8989
examples:
url: http://127.0.0.1:8989
radarr:
title: Radarr Settings
prefix: RADARR_
text: |
## Leaving the [[radarr]] header uncommented (no leading hash #) without also
## uncommenting the api_key (remove the hash #) will produce a startup warning.
defaults:
docker_example:
url: http://radarr:7878
examples:
url: http://127.0.0.1:7878
lidarr:
title: Lidarr Settings
prefix: LIDARR_
comment: true
defaults:
docker_example:
url: http://lidarr:8686
examples:
url: http://127.0.0.1:8686
readarr:
title: Readarr Settings
prefix: READARR_
comment: true
defaults:
docker_example:
url: http://readarr:8787
examples:
url: http://127.0.0.1:8787
whisparr:
title: Whisparr Settings
prefix: WHISPARR_
comment: true
defaults:
docker_example:
url: http://whisparr:6969
examples:
url: http://127.0.0.1:6969

sections:
Expand Down Expand Up @@ -489,6 +499,7 @@ sections:
- name: interval
envvar: INTERVAL
default: 0s
docker: 1s
short: How often poller checks for new folders. Use `1ms` to disable it.
recommend: *FOLDER_INTERVALS
desc: |
Expand Down
31 changes: 26 additions & 5 deletions init/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Param struct {
Name string `yaml:"name"`
EnvVar string `yaml:"envvar"`
Default any `yaml:"default"`
Docker any `yaml:"docker"`
Example any `yaml:"example"`
Short string `yaml:"short"`
Desc string `yaml:"desc"`
Expand All @@ -70,11 +71,13 @@ type Param struct {
}

type Def struct {
Comment bool `yaml:"comment"` // just the header.
Title string `yaml:"title"`
Prefix string `yaml:"prefix"`
Text string `yaml:"text"`
Defaults map[string]any `yaml:"defaults"`
Comment bool `yaml:"comment"` // just the header.
Title string `yaml:"title"`
Prefix string `yaml:"prefix"`
Text string `yaml:"text"`
Defaults map[string]any `yaml:"defaults"`
Examples map[string]any `yaml:"examples"`
DockerExample map[string]any `yaml:"docker_example"`
}

type Defs map[section]*Def
Expand Down Expand Up @@ -181,6 +184,24 @@ func createDefinedSection(def *Def, section *Header) *Header {
}
}

// Do it again, but with examples.
for overrideName, override := range def.Examples {
for _, defined := range newSection.Params {
if defined.Name == overrideName {
defined.Example = override
}
}
}

// Do it again, but with the docker defaults.
for overrideName, override := range def.DockerExample {
for _, defined := range newSection.Params {
if defined.Name == overrideName {
defined.Docker = override
}
}
}

return newSection
}

Expand Down