Skip to content

Comments

feat(config): add support for include directive in configuration#140

Open
dmayle wants to merge 1 commit intofiffeek:mainfrom
dmayle:includes
Open

feat(config): add support for include directive in configuration#140
dmayle wants to merge 1 commit intofiffeek:mainfrom
dmayle:includes

Conversation

@dmayle
Copy link

@dmayle dmayle commented Dec 15, 2025

What does this PR do?

This change introduces the 'include' directive to the TOML configuration system, resolving #139. Users can now modularize their configuration by splitting profiles across multiple files.

Key implementation details:

  • Implemented recursive pre-processing in 'processIncludes' to merge file content before TOML decoding.
  • Supports both single strings and lists of strings for the 'include' key.
  • Handles relative paths relative to the directory of the file currently being processed.
  • Enforces a recursion depth limit to prevent infinite loops.
  • Added comprehensive tests covering relative paths and list inclusions.
  • Updated filewatcher to monitor included files for changes, triggering auto-reload.
  • Code quality improvements: regex compilation optimization, better error wrapping, and constant usage.

Why is this change important?

Makes dynamic configs more palatable when using Nix

How to test this PR locally?

There are tests included, but you can just split your config with an include directive

Related issues

Closes #234

This change introduces the 'include' directive to the TOML configuration system, resolving fiffeek#139. Users can now modularize their configuration by splitting profiles across multiple files.

Key implementation details:
- Implemented recursive pre-processing in 'processIncludes' to merge file content before TOML decoding.
- Supports both single strings and lists of strings for the 'include' key.
- Handles relative paths relative to the directory of the file currently being processed.
- Enforces a recursion depth limit to prevent infinite loops.
- Added comprehensive tests covering relative paths and list inclusions.
- Updated filewatcher to monitor included files for changes, triggering auto-reload.
- Code quality improvements: regex compilation optimization, better error wrapping, and constant usage.
@fiffeek
Copy link
Owner

fiffeek commented Dec 16, 2025

Hey! Thanks for the contribution, collecting my thoughts about the implementation and will get back to you shortly, overall great job!

@fiffeek fiffeek mentioned this pull request Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants