Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 8, 2024
1 parent 85e22ae commit 0305675
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use figment::{
providers::{Env, Format, Yaml},
Figment,
Metadata,
Provider,
Profile,
Figment, Metadata, Profile, Provider,
};
use serde::{Deserialize, Serialize};
use std::net::SocketAddr;
Expand Down Expand Up @@ -85,23 +82,17 @@ impl Default for Config {

impl Config {
fn figment() -> Figment {
let figment = Figment::from(Config::default())
.merge(Env::prefixed("TASKWORKER_"));
figment
Figment::from(Config::default()).merge(Env::prefixed("TASKWORKER_"))
}

/// Build a Config instance from defaults and Env vars
pub fn from_env() -> Result<Self, figment::Error> {
let config = Config::figment().extract();
config
Config::figment().extract()
}

/// Build a Config instance from default, env vars and a file.
pub fn from_file(path: &Path) -> Result<Self, figment::Error> {
let config = Config::figment()
.merge(Yaml::file(path))
.extract();
config
Config::figment().merge(Yaml::file(path)).extract()
}
}

Expand Down

0 comments on commit 0305675

Please sign in to comment.