shuttle: add dotenvy for handling envvars
This commit is contained in:
parent
d52e5a9fbd
commit
ce1f80cd4f
3 changed files with 12 additions and 0 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
|
@ -415,6 +415,7 @@ dependencies = [
|
|||
"base64 0.22.0",
|
||||
"clap 4.5.4",
|
||||
"dotenv",
|
||||
"dotenvy",
|
||||
"flume",
|
||||
"futures-util",
|
||||
"headers",
|
||||
|
|
@ -730,6 +731,12 @@ dependencies = [
|
|||
"clap 2.34.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dotenvy"
|
||||
version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
|
||||
[[package]]
|
||||
name = "ecdsa"
|
||||
version = "0.16.9"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ headers = "0.4"
|
|||
tower = { version = "0.4", features = ["util"] }
|
||||
shuttle-axum = { version = "0.44.0", optional = true }
|
||||
shuttle-runtime = { version = "0.44.0", optional = true }
|
||||
dotenvy = "0.15.7"
|
||||
|
||||
[build-dependencies]
|
||||
prost-build = "0.12.4"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
use crate::cli::args::Args;
|
||||
#[cfg(not(feature = "shuttle"))]
|
||||
use dotenv::dotenv;
|
||||
#[cfg(feature = "shuttle")]
|
||||
use dotenvy::dotenv;
|
||||
#[cfg(feature = "shuttle")]
|
||||
use shuttle_axum::ShuttleAxum;
|
||||
use tracing::error;
|
||||
#[cfg(not(feature = "shuttle"))]
|
||||
|
|
@ -43,6 +46,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||
#[cfg(feature = "shuttle")]
|
||||
#[shuttle_runtime::main]
|
||||
async fn main() -> ShuttleAxum {
|
||||
dotenv().ok();
|
||||
let app_host = env::var("APP_HOST").unwrap_or("0.0.0.0".to_string());
|
||||
let app_port = env::var("APP_PORT").unwrap_or("8000".to_string());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue