Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow any configuration value to be defined in any file #146

Merged
merged 24 commits into from
Nov 7, 2023

Conversation

Callum027
Copy link
Member

@Callum027 Callum027 commented Nov 7, 2023

Change the initial per-file validation of configuration files into a non-validating parsing and expansion of LocalPath attributes based on the dynamically generated Pydantic model.

This allows validation of only LocalPath type attributes while not validating anything else until the combined configuration structure is loaded properly.

With this change, the limitation where individual configuration files need to be syntatically correct on its own has now been lifted. The combined files being loaded, as a set, being correct is sufficient.

* Disable model validation for configuration files on the initial pass (while still parsing them into objects)
* Change `LocalPath` to parse relative paths to absolute paths on object creation, instead of validation (to make sure it is *always* validated, even when validation is disabled)
@Callum027 Callum027 added enhancement New feature or request config Issue or pull request related to Buildarr or plugin configuration labels Nov 7, 2023
@Callum027 Callum027 added this to the v0.6.2 milestone Nov 7, 2023
@Callum027 Callum027 self-assigned this Nov 7, 2023
@Callum027 Callum027 linked an issue Nov 7, 2023 that may be closed by this pull request
@Callum027
Copy link
Member Author

Callum027 commented Nov 7, 2023

Tested working.

buildarr.yml:

---

includes:
  - sonarr.yml
  - radarr.yml
  - prowlarr.yml
  - jellyseerr.yml
  - config2/buildarr-2.yml 

buildarr:
  watch_config: false  # Tell Buildarr to reload using SIGHUP.
  update_days:
    - "monday"
    - "tuesday"
    - "wednesday"
    - "thursday"
    - "friday"
    - "saturday"
    - "sunday"
  update_times:
    - "03:00"
  request_timeout: 30
  # secrets_file_path: "secrets.json"

config2/buildarr-2.yml:

---

buildarr:
  secrets_file_path: "secrets2.json"

prowlarr.yml (excerpt):

---

includes:
  - config2/prowlarr-2.yml

prowlarr:
  instances:
    prowlarr:
      api_key: <snip>
      settings:
        indexers:
          indexers:
            definitions:
              "Nyaa.si":
                type: nyaasi
                enable: true
                sync_profile: Standard
                redirect: false
                priority: 15
                grab_limit: 50  # 104
                query_limit: 10010
                tags:
                  - shows
                  - movies
                  - anime-shows
                  - anime-movies
                fields:
                  torrentBaseSettings.seedRatio: null
                  prefer_magnet_links: true

config2/prowlarr-2.yml:

---

prowlarr:
  instances:
    prowlarr:
      settings:
        indexers:
          indexers:
            definitions:
              "Nyaa.si":
                # The following are normally required, but not defined in the included file, to demonstrate the changes work.
                # type: nyaasi
                # sync_profile: Standard
                grab_limit: 104

buildarr test-config debug output: buildarr_test-config.log

@Callum027 Callum027 merged commit aa07c7d into main Nov 7, 2023
1 check passed
@Callum027 Callum027 deleted the 145-config-validation-improvements branch November 7, 2023 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Issue or pull request related to Buildarr or plugin configuration enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow any configuration value to be defined in any file
1 participant