nylonee / watchlistarr

Customizable sync of Plex Watchlist to Sonarr/Radarr
GNU General Public License v3.0
174 stars 14 forks source link

config.yaml not read #112

Closed Cazz0r closed 5 months ago

Cazz0r commented 5 months ago

Running on Windows, using Plex, Sonarr & Radarr at default ports.

After executing: java -Dsonarr.apikey=REDACTED -Dradarr.apikey=REDACTED -Dplex.token=REDACTED -Xmx100m -jar watchlistarr.jar

The config.yaml is created, after uncommenting and modifying the vast majority of options I would have expected to be able to simply execute: java -Xmx100m -jar watchlistarr.jar and have it use the config parameters, however, output shows:

Exception in thread "main" java.lang.IllegalArgumentException: Unable to find sonarr API key
        at configuration.ConfigurationUtils$.throwError(ConfigurationUtils.scala:263)
        at configuration.ConfigurationUtils$.$anonfun$getSonarrConfig$3(ConfigurationUtils.scala:84)
        at scala.Option.getOrElse(Option.scala:201)
        at configuration.ConfigurationUtils$.getSonarrConfig(ConfigurationUtils.scala:84)
        at configuration.ConfigurationUtils$.create(ConfigurationUtils.scala:22)
        at Server$.run(Server.scala:25)
        at cats.effect.IOApp.main(IOApp.scala:396)
        at cats.effect.IOApp.main$(IOApp.scala:333)
        at Server$.main(Server.scala:11)
        at Server.main(Server.scala)

Even with executing the original command (with api keys and token as parameters), it does not seem to utilize the tags for either radarr or sonarr.

Edit: formatting

nylonee commented 5 months ago

Thanks for raising this, this should definitely be possible, if you provided the API keys as part of the command, and had other configuration defined in config.yaml, then does it still pull the rest of the config from config.yaml?

nylonee commented 5 months ago

I've also added CONFIGURATION.md documentation, could you please check against the documentation and make sure that you're not missing any steps?

Cazz0r commented 5 months ago

@nylonee You set me on the right path, I found the issue was within my configuration file - not correctly formatted.

Turns out I hadn't correctly escaped the rootFolder configuration options, when they weren't correctly escaped the error thrown was "Unable to find sonarr API key" - this was leading me astray as I thought simply the config file wasn't being read at all.

After fixing the escaping, everything worked as we thought it would - that is; simply "java -Xmx100m -jar watchlistarr.jar" was possible.

nylonee commented 5 months ago

Ah interesting! Could you share some more details? Perhaps it's something that Watchlistarr can add some safety in for

I'd be interested in what your rootFolder looked like before and after the change

Cazz0r commented 5 months ago

Absolutely!

I had the following: sonarr rootFolder config was set as "H:\TV Shows\" radarr rootFolder config was set as "H:\Movies\"

With that setup, I wasn't able to simply run "java -Xmx100m -jar watchlistarr.jar", as it was throwing "Unable to find sonarr API key" error, which I took to mean it wasn't reading the config file, however, your new CONFIGURATION.md documentation pointed me at a syntax checker, and after copying and pasting my config.yaml into yamllint, it showed "invalid escape sequence" on the sonarr rootFolder line.

So, I adjusted the config to sonarr rootFolder "H:\\TV Shows\\" radarr rootFolder "H:\\Movies\\"

Then, running "java -Xmx100m -jar watchlistarr.jar" resulted in error "Unable to find root folder H:\TV Shows. Possible values are List(H:\TV Shows)". Which I deduced simply meant I didn't need the backslash at the end of the config parameters. So potential suggestion here would be to strip any trailing backslashes, but the error thrown from a misconfiguration here is quite alright.

Final update to config was sonarr rootFolder "H:\\TV Shows" radarr rootFolder "H:\\Movies"

And there were no further errors and I'm able to run "java -Xmx100m -jar watchlistarr.jar", even better, I now have sonarr/radarr tags being added correctly as the config file is being read properly - so ultimately, I feel it was always being read, it just had a syntax error, and then not being utilized.

nylonee commented 5 months ago

Great, that's good to know, thanks for the information! I'll close this issue now :)