onedr0p / exportarr

AIO Prometheus Exporter for Sabnzbd, Bazarr, Prowlarr, Lidarr, Readarr, Radarr, and Sonarr
MIT License
575 stars 43 forks source link

Config file support for sabnzbd, bazarr #294

Open rouke-broersma opened 6 months ago

rouke-broersma commented 6 months ago

Details

Describe the solution you'd like:

It seems to me like the config file is not supported for sabnzbd, bazarr and possibly other apps that don't follow the common xml config file. It would be great if that could be supported so I don't have to create an api key secret and can leverage the sidecar pattern to load the config. I have checked and both sabnzbd and bazarr contain the api key in a config file. For sabnzbd it's in the ini format and for modern bazarr it seems to be in yaml format.

onedr0p commented 6 months ago

I am open to PRs for this. 👍🏼

rtrox commented 6 months ago

Both TOML (ini) and YAML are supported by Koanf, this shouldn't be terribly difficult.

https://github.com/knadh/koanf?tab=readme-ov-file#bundled-parsers

The XML parsing logic to use as a guide:

https://github.com/knadh/koanf?tab=readme-ov-file#bundled-parsers

Bazarr Loader: https://github.com/onedr0p/exportarr/blob/master/internal/arr/config/bazarr.go#L43 SabNZB Loader: https://github.com/onedr0p/exportarr/blob/master/internal/sabnzbd/config/config.go#L14-L21

Things are a bit crazy for me at work, or I'd pick this up. Glad to review PRs, and I may be able to come back to this later on if no one picks it up.

rouke-broersma commented 6 months ago

Had a look at this and as you said in theory it should be easy enough but I really seem to have trouble grasping Golang unfortunately..