Skip to content

Commit 3150d06

Browse files
authored
Merge pull request #481 from Unpackerr/dn2_docker_compose
add overrides for examples and docker
2 parents e7c1ca2 + 9e2986d commit 3150d06

5 files changed

Lines changed: 55 additions & 21 deletions

File tree

examples/docker-compose.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ services:
5050
- UN_WEBSERVER_URLBASE=/
5151
- UN_WEBSERVER_UPSTREAMS=
5252
## Folder Settings
53-
- UN_FOLDERS_INTERVAL=0s
53+
- UN_FOLDERS_INTERVAL=1s
5454
- UN_FOLDERS_BUFFER=20000
5555
## Sonarr Settings
56-
- UN_SONARR_0_URL=http://127.0.0.1:8989
56+
- UN_SONARR_0_URL=http://sonarr:8989
5757
- UN_SONARR_0_API_KEY=0123456789abcdef0123456789abcdef
5858
- UN_SONARR_0_PATHS_0=/downloads
5959
- UN_SONARR_0_PROTOCOLS=torrent
@@ -62,7 +62,7 @@ services:
6262
- UN_SONARR_0_DELETE_ORIG=false
6363
- UN_SONARR_0_SYNCTHING=false
6464
## Radarr Settings
65-
- UN_RADARR_0_URL=http://127.0.0.1:7878
65+
- UN_RADARR_0_URL=http://radarr:7878
6666
- UN_RADARR_0_API_KEY=0123456789abcdef0123456789abcdef
6767
- UN_RADARR_0_PATHS_0=/downloads
6868
- UN_RADARR_0_PROTOCOLS=torrent
@@ -71,7 +71,7 @@ services:
7171
- UN_RADARR_0_DELETE_ORIG=false
7272
- UN_RADARR_0_SYNCTHING=false
7373
## Lidarr Settings
74-
- UN_LIDARR_0_URL=http://127.0.0.1:8686
74+
- UN_LIDARR_0_URL=http://lidarr:8686
7575
- UN_LIDARR_0_API_KEY=0123456789abcdef0123456789abcdef
7676
- UN_LIDARR_0_PATHS_0=/downloads
7777
- UN_LIDARR_0_PROTOCOLS=torrent
@@ -80,7 +80,7 @@ services:
8080
- UN_LIDARR_0_DELETE_ORIG=false
8181
- UN_LIDARR_0_SYNCTHING=false
8282
## Readarr Settings
83-
- UN_READARR_0_URL=http://127.0.0.1:8787
83+
- UN_READARR_0_URL=http://readarr:8787
8484
- UN_READARR_0_API_KEY=0123456789abcdef0123456789abcdef
8585
- UN_READARR_0_PATHS_0=/downloads
8686
- UN_READARR_0_PROTOCOLS=torrent
@@ -89,7 +89,7 @@ services:
8989
- UN_READARR_0_DELETE_ORIG=false
9090
- UN_READARR_0_SYNCTHING=false
9191
## Whisparr Settings
92-
- UN_WHISPARR_0_URL=http://127.0.0.1:6969
92+
- UN_WHISPARR_0_URL=http://whisparr:6969
9393
- UN_WHISPARR_0_API_KEY=0123456789abcdef0123456789abcdef
9494
- UN_WHISPARR_0_PATHS_0=/downloads
9595
- UN_WHISPARR_0_PROTOCOLS=torrent
@@ -135,4 +135,4 @@ services:
135135
- UN_CMDHOOK_0_EXCLUDE_1=lidarr
136136
- UN_CMDHOOK_0_TIMEOUT=10s
137137

138-
## => Content Auto Generated, 31 JUL 2024 17:36 UTC
138+
## => Content Auto Generated, 02 AUG 2024 02:13 UTC

examples/unpackerr.conf.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,4 @@ dir_mode = "0755"
301301
## You can adjust how long to wait for the command to run.
302302
# timeout = "10s"
303303

304-
## => Content Auto Generated, 31 JUL 2024 17:36 UTC
304+
## => Content Auto Generated, 02 AUG 2024 02:13 UTC

init/config/compose.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ func (h *Header) makeComposeDefined(prefix string, defs Defs, order []section, b
9999
}
100100

101101
func (p *Param) Compose(prefix string) string {
102-
val := p.Default
103-
if p.Example != nil {
104-
val = p.Example
102+
val := p.Example
103+
if p.Docker != nil {
104+
val = p.Docker
105+
} else if val == nil {
106+
val = p.Default
105107
}
106108

107109
switch p.Kind {

init/config/definitions.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,33 +157,43 @@ defs:
157157
text: |
158158
## Leaving the [[sonarr]] header uncommented (no leading hash #) without also
159159
## uncommenting the api_key (remove the hash #) will produce a startup warning.
160-
defaults:
160+
docker_example:
161+
url: http://sonarr:8989
162+
examples:
161163
url: http://127.0.0.1:8989
162164
radarr:
163165
title: Radarr Settings
164166
prefix: RADARR_
165167
text: |
166168
## Leaving the [[radarr]] header uncommented (no leading hash #) without also
167169
## uncommenting the api_key (remove the hash #) will produce a startup warning.
168-
defaults:
170+
docker_example:
171+
url: http://radarr:7878
172+
examples:
169173
url: http://127.0.0.1:7878
170174
lidarr:
171175
title: Lidarr Settings
172176
prefix: LIDARR_
173177
comment: true
174-
defaults:
178+
docker_example:
179+
url: http://lidarr:8686
180+
examples:
175181
url: http://127.0.0.1:8686
176182
readarr:
177183
title: Readarr Settings
178184
prefix: READARR_
179185
comment: true
180-
defaults:
186+
docker_example:
187+
url: http://readarr:8787
188+
examples:
181189
url: http://127.0.0.1:8787
182190
whisparr:
183191
title: Whisparr Settings
184192
prefix: WHISPARR_
185193
comment: true
186-
defaults:
194+
docker_example:
195+
url: http://whisparr:6969
196+
examples:
187197
url: http://127.0.0.1:6969
188198

189199
sections:
@@ -489,6 +499,7 @@ sections:
489499
- name: interval
490500
envvar: INTERVAL
491501
default: 0s
502+
docker: 1s
492503
short: How often poller checks for new folders. Use `1ms` to disable it.
493504
recommend: *FOLDER_INTERVALS
494505
desc: |

init/config/main.go

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type Param struct {
6262
Name string `yaml:"name"`
6363
EnvVar string `yaml:"envvar"`
6464
Default any `yaml:"default"`
65+
Docker any `yaml:"docker"`
6566
Example any `yaml:"example"`
6667
Short string `yaml:"short"`
6768
Desc string `yaml:"desc"`
@@ -70,11 +71,13 @@ type Param struct {
7071
}
7172

7273
type Def struct {
73-
Comment bool `yaml:"comment"` // just the header.
74-
Title string `yaml:"title"`
75-
Prefix string `yaml:"prefix"`
76-
Text string `yaml:"text"`
77-
Defaults map[string]any `yaml:"defaults"`
74+
Comment bool `yaml:"comment"` // just the header.
75+
Title string `yaml:"title"`
76+
Prefix string `yaml:"prefix"`
77+
Text string `yaml:"text"`
78+
Defaults map[string]any `yaml:"defaults"`
79+
Examples map[string]any `yaml:"examples"`
80+
DockerExample map[string]any `yaml:"docker_example"`
7881
}
7982

8083
type Defs map[section]*Def
@@ -181,6 +184,24 @@ func createDefinedSection(def *Def, section *Header) *Header {
181184
}
182185
}
183186

187+
// Do it again, but with examples.
188+
for overrideName, override := range def.Examples {
189+
for _, defined := range newSection.Params {
190+
if defined.Name == overrideName {
191+
defined.Example = override
192+
}
193+
}
194+
}
195+
196+
// Do it again, but with the docker defaults.
197+
for overrideName, override := range def.DockerExample {
198+
for _, defined := range newSection.Params {
199+
if defined.Name == overrideName {
200+
defined.Docker = override
201+
}
202+
}
203+
}
204+
184205
return newSection
185206
}
186207

0 commit comments

Comments
 (0)