feat: introduce Kaal configuration file loader - #111
Merged
Conversation
- Added a new `FileLoader` class to load Kaal runtime configuration from `config/kaal.yml` and environment variables. - Implemented methods to parse YAML, merge environment configurations, and apply overrides from environment variables. - Updated existing integration tests to use the new configuration format and file paths. - Changed references from `scheduler.yml` to `kaal-scheduler.yml` for consistency across the codebase. - Enhanced error handling for configuration loading, including specific error messages for invalid environment variable coercions.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates Kaal’s runtime configuration from a Ruby file (config/kaal.rb) to a YAML-based loader (config/kaal.yml) with support for environment-specific sections and KAAL_* env var overrides, while also standardizing the scheduler file name to config/kaal-scheduler.yml across the codebase.
Changes:
- Introduce a YAML configuration loader (
Kaal::Config::FileLoader) and symbolic backend construction (Kaal::Config::BackendFactory). - Rename scheduler config from
scheduler.ymltokaal-scheduler.ymland update CLI/framework integrations accordingly. - Update docs and tests (unit + integration + e2e) to use the new config formats/paths.
Reviewed changes
Copilot reviewed 58 out of 63 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Update top-level docs to reference config/kaal.yml and config/kaal-scheduler.yml. |
| gems/kaal/spec/support/integration_support.rb | Switch integration helpers to write YAML config and load via new API. |
| gems/kaal/spec/kaal/scheduler_file_loader_spec.rb | Update scheduler path references to kaal-scheduler.yml. |
| gems/kaal/spec/kaal/registry_backend_runtime_spec.rb | Update runtime context path expectations and scheduler file naming. |
| gems/kaal/spec/kaal/configuration_and_utils_spec.rb | Add coverage for YAML loading, env overrides, and backend factory behavior. |
| gems/kaal/spec/kaal/cli_spec.rb | Update init expectations for new config filenames. |
| gems/kaal/spec/kaal_api_and_cli_spec.rb | Add public API test for config-file loading; update CLI paths/templates. |
| gems/kaal/spec/e2e/kaal/kaal_sqlite_integration_spec.rb | Migrate sqlite e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/kaal_redis_integration_spec.rb | Migrate redis e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/kaal_postgres_integration_spec.rb | Migrate postgres e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/kaal_mysql_integration_spec.rb | Migrate mysql e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/kaal_memory_integration_spec.rb | Migrate memory e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/cli_integration_spec.rb | Update CLI e2e to YAML config + scheduler YAML definitions. |
| gems/kaal/spec/e2e/kaal/active_record_sqlite_integration_spec.rb | Migrate ActiveRecord sqlite e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/active_record_postgres_integration_spec.rb | Migrate ActiveRecord postgres e2e to YAML runtime config. |
| gems/kaal/spec/e2e/kaal/active_record_mysql_integration_spec.rb | Migrate ActiveRecord mysql e2e to YAML runtime config. |
| gems/kaal/README.md | Update gem README to YAML config + new scheduler filename. |
| gems/kaal/lib/kaal/scheduler_file/loader.rb | Update inline documentation for new scheduler filename. |
| gems/kaal/lib/kaal/runtime/scheduler_boot_loader.rb | Update inline documentation for new scheduler filename. |
| gems/kaal/lib/kaal/config/file_loader.rb | New YAML config loader with env + env-var override support. |
| gems/kaal/lib/kaal/config/configuration.rb | Add backend_config, symbolic backend support, and new default scheduler path. |
| gems/kaal/lib/kaal/config/backend_factory.rb | New backend factory to build adapters from symbolic config + backend_config. |
| gems/kaal/lib/kaal/config.rb | Wire new config components into the config surface. |
| gems/kaal/lib/kaal/cli.rb | Update CLI to load YAML config and write new templates/paths. |
| gems/kaal/lib/kaal/backend/adapter.rb | Add disconnect_for_fork default hook to base adapter. |
| gems/kaal/lib/kaal.rb | Add public API method load_config_file!. |
| gems/kaal/config/kaal.yml | Add default YAML runtime config template. |
| gems/kaal/config/kaal.rb | Remove Ruby runtime config template. |
| gems/kaal/config/kaal-scheduler.yml | Add default scheduler YAML template under new name. |
| gems/kaal/.rubocop.yml | Loosen RuboCop limits (example length / complexity). |
| gems/kaal-sinatra/spec/kaal/sinatra_spec.rb | Update Sinatra integration specs for new scheduler path. |
| gems/kaal-sinatra/spec/dummy/modular/config/kaal-scheduler.yml | Add dummy scheduler file under new name. |
| gems/kaal-sinatra/spec/dummy/modular/app.rb | Generate YAML config at runtime for dummy app (new loader path). |
| gems/kaal-sinatra/spec/dummy/classic/config/kaal-scheduler.yml | Add dummy scheduler file under new name. |
| gems/kaal-sinatra/spec/dummy/classic/app.rb | Generate YAML config at runtime for dummy app (new loader path). |
| gems/kaal-sinatra/README.md | Update Sinatra docs to new scheduler filename and YAML-based config flow. |
| gems/kaal-sinatra/lib/kaal/sinatra.rb | Load YAML config file during register! and apply overrides. |
| gems/kaal-roda/spec/kaal/roda_spec.rb | Update Roda integration specs for new scheduler path. |
| gems/kaal-roda/spec/dummy/config/kaal-scheduler.yml | Add dummy scheduler file under new name. |
| gems/kaal-roda/spec/dummy/app.rb | Generate YAML config at runtime for dummy app (new loader path). |
| gems/kaal-roda/README.md | Update Roda docs to new scheduler filename and YAML-based config flow. |
| gems/kaal-roda/lib/kaal/roda.rb | Load YAML config file during register! and apply overrides. |
| gems/kaal-rails/spec/kaal/rails_spec.rb | Update Rails install/generator expectations for runtime config + new scheduler name. |
| gems/kaal-rails/spec/e2e/kaal/rails_sqlite_integration_spec.rb | Update rails sqlite e2e for new scheduler filename. |
| gems/kaal-rails/spec/e2e/kaal/rails_redis_integration_spec.rb | Add YAML runtime config creation for redis rails e2e; update scheduler filename. |
| gems/kaal-rails/spec/e2e/kaal/rails_memory_integration_spec.rb | Add YAML runtime config creation for memory rails e2e; update scheduler filename. |
| gems/kaal-rails/spec/dummy/config/initializers/kaal.rb | Update dummy initializer to write YAML config for tests. |
| gems/kaal-rails/README.md | Update Rails README for new scheduler filename. |
| gems/kaal-rails/lib/tasks/kaal/rails_tasks.rake | Print runtime config creation status in install task output. |
| gems/kaal-rails/lib/kaal/rails/installer.rb | Add runtime config installation (config/kaal.yml) alongside scheduler + migrations. |
| gems/kaal-rails/lib/kaal/rails.rb | Load YAML config during Rails backend configuration; include runtime config in install results. |
| gems/kaal-rails/lib/generators/kaal/install_generator.rb | Output runtime config status during generator install. |
| gems/kaal-rails/.rubocop.yml | Loosen RuboCop example-length limit. |
| gems/kaal-hanami/spec/kaal/hanami_spec.rb | Update Hanami integration specs for new scheduler path. |
| gems/kaal-hanami/spec/dummy/config/kaal-scheduler.yml | Add dummy scheduler file under new name. |
| gems/kaal-hanami/spec/dummy/config/app.rb | Generate YAML config at runtime for dummy app (new loader path). |
| gems/kaal-hanami/README.md | Update Hanami docs to new scheduler filename and YAML-based config flow. |
| gems/kaal-hanami/lib/kaal/hanami/middleware.rb | Update default scheduler path constant to new filename. |
| gems/kaal-hanami/lib/kaal/hanami.rb | Load YAML config file during register! and apply overrides. |
| docs/pages/5-usage.md | Update usage docs to YAML config + new scheduler filename. |
| docs/pages/4-configuration.md | Update configuration docs to YAML config + backend_config/env override guidance. |
| docs/pages/3-install.md | Update install docs to YAML config + new scheduler filename and CLI flag examples. |
| docs/pages/101-faq.md | Update FAQ references to YAML runtime config and new scheduler filename. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FileLoaderclass to load Kaal runtime configuration fromconfig/kaal.ymland environment variables.scheduler.ymltokaal-scheduler.ymlfor consistency across the codebase.