Skip to content

Commit e74c123

Browse files
committed
fix: make all env vars required, no defaults
1 parent 5657cef commit e74c123

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

agent-pdf/src/config.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,16 @@ pub struct Config {
1010

1111
impl Config {
1212
pub fn from_env() -> Self {
13-
let s3_endpoint = env("S3_ENDPOINT");
14-
let s3_bucket = env("S3_BUCKET");
15-
1613
Self {
17-
s3_region: env_or("S3_REGION", "us-east-1"),
18-
s3_public_url: env_or("S3_PUBLIC_URL", &s3_endpoint),
19-
s3_endpoint,
20-
s3_bucket,
21-
default_editor_host: env_or("DEFAULT_EDITOR_HOST", "ai.simplepdf.com"),
22-
rate_limit_per_minute: env_or("RATE_LIMIT_PER_MIN", "30")
14+
s3_endpoint: env("S3_ENDPOINT"),
15+
s3_bucket: env("S3_BUCKET"),
16+
s3_region: env("S3_REGION"),
17+
s3_public_url: env("S3_PUBLIC_URL"),
18+
default_editor_host: env("DEFAULT_EDITOR_HOST"),
19+
rate_limit_per_minute: env("RATE_LIMIT_PER_MIN")
2320
.parse()
2421
.expect("RATE_LIMIT_PER_MIN must be a number"),
25-
trust_proxy: env_or("TRUST_PROXY", "false") == "true",
22+
trust_proxy: env("TRUST_PROXY") == "true",
2623
}
2724
}
2825

@@ -37,7 +34,3 @@ impl Config {
3734
fn env(key: &str) -> String {
3835
std::env::var(key).unwrap_or_else(|_| panic!("{key} must be set"))
3936
}
40-
41-
fn env_or(key: &str, default: &str) -> String {
42-
std::env::var(key).unwrap_or_else(|_| default.to_string())
43-
}

0 commit comments

Comments
 (0)