-
Notifications
You must be signed in to change notification settings - Fork 0
huge refactor #26
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
huge refactor #26
Conversation
- make requests concurrent - rename modules - simplify core api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
| fn replace_env_placeholders(config: &mut String) { | ||
| let result = RE_ENV.replace_all(config, |caps: &Captures| { | ||
| // caps[0] is "${VAR}" | ||
| // caps[1] is "VAR" | ||
| let var_name = &caps[1]; | ||
| // TODO is there a better way to handle this? It would be better to bubble this up since it is not recoverable | ||
| match env::var(var_name) { | ||
| Ok(val) => val, | ||
| Err(_) => panic!("Could not find env.var = {}", &caps[0]), | ||
| } | ||
| }); | ||
|
|
||
| if let Cow::Owned(new_content) = result { | ||
| *config = new_content; | ||
| } |
Copilot
AI
Apr 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider returning a Result error instead of panicking when an environment variable is missing so that the error can be handled gracefully. This would allow the caller to manage the failure without an abrupt termination.
| fn replace_env_placeholders(config: &mut String) { | |
| let result = RE_ENV.replace_all(config, |caps: &Captures| { | |
| // caps[0] is "${VAR}" | |
| // caps[1] is "VAR" | |
| let var_name = &caps[1]; | |
| // TODO is there a better way to handle this? It would be better to bubble this up since it is not recoverable | |
| match env::var(var_name) { | |
| Ok(val) => val, | |
| Err(_) => panic!("Could not find env.var = {}", &caps[0]), | |
| } | |
| }); | |
| if let Cow::Owned(new_content) = result { | |
| *config = new_content; | |
| } | |
| fn replace_env_placeholders(config: &mut String) -> Result<()> { | |
| let result = RE_ENV.replace_all(config, |caps: &Captures| { | |
| // caps[0] is "${VAR}" | |
| // caps[1] is "VAR" | |
| let var_name = &caps[1]; | |
| match env::var(var_name) { | |
| Ok(val) => val, | |
| Err(_) => return Err(anyhow::anyhow!("Missing environment variable: {}", &caps[0])), | |
| } | |
| }); | |
| if let Cow::Owned(new_content) = result { | |
| *config = new_content; | |
| } | |
| Ok(()) |
This pull request includes extensive changes to the
venoproject, focusing on renaming modules, refactoring code, and improving the configuration and notification system. The most important changes include renaming thecliandcoremodules, refactoring theAppConfigandArtifactstructures, and enhancing the notification system.Module Renaming:
clitoveno-cliandcoretoveno-coreinCargo.tomland updated paths accordingly. [1] [2] [3]Refactoring:
AppConfigandArtifactstructures and their associated methods fromcore/src/config.rsandcore/src/artifact/mod.rs. [1] [2]AppStatestructure inveno-core/src/app.rsto handle application state and configuration loading.AppConfigto a simpler structure inveno-core/src/config.rs.Artifactstructure and methods inveno-core/src/artifact/mod.rs.Notification System Enhancements:
artifact_idsto theNotifierstructure to link notifiers to specific artifacts.sendmethod inSinkimplementations to use a consistentnotificationparameter. [1] [2]AppStateto handle artifact version checks and notifications.Dependency Management:
anyhowandtokioas workspace dependencies inCargo.toml.veno-cli/Cargo.tomlandveno-core/Cargo.tomlto use workspace versions. [1] [2]Miscellaneous:
core/src/lib.rstoveno-core/src/lib.rsand updated module imports. [1] [2]EmailSinkandSlackSinkimplementations. [1] [2]These changes collectively improve the structure, maintainability, and functionality of the
venoproject.