Skip to content

Config Overhaul#17

Open
FlyinPancake wants to merge 8 commits intomainfrom
feature/env-config
Open

Config Overhaul#17
FlyinPancake wants to merge 8 commits intomainfrom
feature/env-config

Conversation

@FlyinPancake
Copy link
Collaborator

@FlyinPancake FlyinPancake commented Sep 25, 2025

This pull request introduces significant improvements to the configuration system for freecaster-grid, adding support for flexible YAML and environment variable-based configuration, restructuring config schemas, and updating documentation and test files accordingly. The changes modernize how configuration is handled, making the application easier to deploy and manage, especially in containerized environments.

Configuration System Overhaul

  • Replaced the old flat config structure with a nested schema: telegram settings are now grouped under a telegram section, and server.ssl is now an object with cert_path and key_path fields. The nodes field is now a map keyed by node name instead of a list.

  • Added support for configuration via environment variables, using the config crate with double underscore (__) separators and case conversion, enabling full configuration without a YAML file.

  • Updated the configuration loader to merge YAML file and environment variables, and refactored the codebase to use the new config schema throughout.

  • Added JSONSchema support via the json_schema feature
    Documentation and Example Updates

  • Expanded the README.md to document the new configuration format, including detailed examples for both YAML and environment variable usage.

  • Updated example and test config files (config.test.yaml, config.test2.yaml, config.test3.yaml) to match the new schema, demonstrating both SSL and telegram config nesting.

  • Added yaml-language-server example to config.test.yaml

Codebase and Versioning

  • Bumped the crate version to 0.3.0 and added the config crate as a dependency in Cargo.toml.
    Internal Refactors

  • Refactored all code paths that accessed config fields (e.g., server SSL, telegram, nodes) to use the new nested structures and map-based nodes.
    These changes make configuration more robust, flexible, and maintainable, paving the way for easier deployments and future enhancements.

@FlyinPancake
Copy link
Collaborator Author

Fixes #2 completely

@FlyinPancake FlyinPancake self-assigned this Sep 25, 2025
@github-actions
Copy link

github-actions bot commented Sep 25, 2025

Docker image(s) for this PR are available:

  • ghcr.io/dewyer/freecaster-grid:pr-17
  • ghcr.io/dewyer/freecaster-grid:sha-354d9bc

Try locally:

docker pull ghcr.io/dewyer/freecaster-grid:pr-17

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modernizes the configuration system for freecaster-grid by introducing YAML-based configuration with environment variable support, restructuring the config schema with nested objects, and updating all related documentation and test files.

  • Replaced flat config structure with nested schema (telegram config grouped, SSL as nested object, nodes as map instead of list)
  • Added comprehensive environment variable configuration support using the config crate with double underscore separators
  • Updated all code paths to work with the new nested configuration structure and map-based node storage

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/config.rs Complete config system overhaul with new nested structures and environment variable support
src/main.rs Updated config loading logic to support optional config files and new SSL structure
src/poller.rs Adapted all node iteration logic for map-based storage and new telegram config structure
src/json_schema.rs Added JSON schema generation feature for configuration validation
Cargo.toml Added config crate dependency and JSON schema feature flag
README.md Comprehensive documentation update with examples for both YAML and environment variable configuration
config.test*.yaml Updated all test configs to match new nested schema format
config.schema.json Generated JSON schema file for configuration validation
.vscode/settings.json Added VS Code settings for optional JSON schema feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@NuunMoon NuunMoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good work!

@FlyinPancake FlyinPancake linked an issue Sep 26, 2025 that may be closed by this pull request
@NuunMoon
Copy link
Collaborator

NuunMoon commented Oct 4, 2025

Is there anything blocking this merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor configfiles

4 participants