Skip to content

Commit

Permalink
Merge branch 'main' into 16-automate-end-to-end-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan committed Jun 27, 2024
2 parents b11b3e1 + 405f047 commit 0d658fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/bin/daemon.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

use anyhow::Result;
use dotenv::dotenv;
use serde::Deserialize;
Expand Down Expand Up @@ -30,7 +32,10 @@ struct Config {
impl Config {
pub fn new() -> Result<Self> {
let config = config::Config::builder()
.add_source(config::File::with_name("daemon.toml").required(false))
.add_source(
config::File::with_name(&env::var("DAEMON_CONFIG").unwrap_or("daemon.toml".into()))
.required(false),
)
.add_source(config::Environment::with_prefix("daemon").separator("_"))
.build()?
.try_deserialize()?;
Expand Down
7 changes: 6 additions & 1 deletion src/bin/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

use anyhow::Result;
use dotenv::dotenv;
use serde::Deserialize;
Expand Down Expand Up @@ -38,7 +40,10 @@ struct Config {
impl Config {
pub fn new() -> Result<Self> {
let config = config::Config::builder()
.add_source(config::File::with_name("rpc.toml").required(false))
.add_source(
config::File::with_name(&env::var("RPC_CONFIG").unwrap_or("rpc.toml".into()))
.required(false),
)
.add_source(config::Environment::with_prefix("rpc").separator("_"))
.build()?
.try_deserialize()?;
Expand Down

0 comments on commit 0d658fe

Please sign in to comment.