Skip to content

feat: Adds config files and management to CLI#43

Closed
thomastaylor312 wants to merge 1 commit intomicrosoft:mainfrom
thomastaylor312:feat/config_file
Closed

feat: Adds config files and management to CLI#43
thomastaylor312 wants to merge 1 commit intomicrosoft:mainfrom
thomastaylor312:feat/config_file

Conversation

@thomastaylor312
Copy link
Copy Markdown
Collaborator

@thomastaylor312 thomastaylor312 commented Jul 29, 2025

This adds basic configuration for the things we already have. In a follow up I'll add support for OCI credentials and allowed repositories

Closes #24

@Mossaka Mossaka requested a review from Copilot July 30, 2025 18:38
Copy link
Copy Markdown
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 adds configuration file management to the CLI, allowing users to configure plugin directories and policy files through TOML configuration files, environment variables, or command-line arguments with proper precedence.

Key Changes

  • Migrated from hardcoded default directory logic to a flexible configuration system using the figment crate
  • Added support for TOML configuration files with environment variable overrides
  • Restructured CLI command structure to use a dedicated Serve struct with serialization support

Reviewed Changes

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

File Description
src/main.rs Refactored CLI structure and removed hardcoded directory logic in favor of config module
src/config.rs Added comprehensive configuration management with file, environment, and CLI precedence
Cargo.toml Added dependencies for configuration management (figment, etcetera)

get_component_dir().unwrap_or_else(|_| {
eprintln!("WARN: Unable to determine default component directory, using `components` directory in the current working directory");
PathBuf::from("./components")
})
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

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

The warning message uses eprintln! which bypasses the application's logging system. Consider using the tracing crate for consistent logging throughout the application.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This was purposeful because this function is called on creation of the clap App so the logging is not necessarily initialized at this point

Copy link
Copy Markdown
Collaborator

@Mossaka Mossaka left a comment

Choose a reason for hiding this comment

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

A bunch of renames are needed

@thomastaylor312
Copy link
Copy Markdown
Collaborator Author

Ok, think I got all the renames done

@Mossaka
Copy link
Copy Markdown
Collaborator

Mossaka commented Aug 1, 2025

@microsoft-github-policy-service rerun

@Mossaka
Copy link
Copy Markdown
Collaborator

Mossaka commented Aug 2, 2025

Need a rebase and there are some linting issues

@thomastaylor312
Copy link
Copy Markdown
Collaborator Author

I swear my auto format isn't working in VSCode anymore. Pushing up the rebase and lint fixes soon

This adds basic configuration for the things we already have. In a follow
up I'll add support for OCI credentials and allowed repositories

Closes #34

Signed-off-by: Taylor Thomas <taylor@oftaylor.com>
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.

Figure out our config story

3 participants