Template
feat: Baseline added with config support
This commit is contained in:
1 parent
76934a6d76
commit
91ee0abc15
20 files changed
+1168
No files matched your search
@@ -0,0 +1,17 @@
|
||||
use std::fs;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::models::config::Config;
|
||||
|
||||
// Temporary class to map from entire "Cargo.toml" file to only grab the portions under [app]
|
||||
#[derive(Deserialize)]
|
||||
struct TomlConfig {
|
||||
app: Config
|
||||
}
|
||||
|
||||
pub fn get_app_config() -> Result<Config, Box<dyn std::error::Error>> {
|
||||
let cargo_content = fs::read_to_string("Cargo.toml")?;
|
||||
let config: TomlConfig = toml::from_str(&cargo_content)?;
|
||||
|
||||
return Ok(config.app);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod config;
|
||||
Reference in new issue
Block a user