Skip to content

Commit

Permalink
read env vars from next.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jan 17, 2023
1 parent 8e9b259 commit 91c0cf2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/next-core/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ pub async fn env_for_js(
"__NEXT_IMAGE_OPTS".to_string() => serde_json::to_string(&image_config).unwrap(),
};

for (var, val) in next_config.env.iter() {
map.insert(var.clone(), val.clone());
}

if next_config.react_strict_mode.unwrap_or(false) {
map.insert("__NEXT_STRICT_MODE".to_string(), "true".to_string());
}
Expand Down
1 change: 1 addition & 0 deletions crates/next-core/src/next_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct NextConfig {
pub env: Option<HashMap<String, String>>,
pub compiler: Option<CompilerConfig>,
pub images: ImageConfig,
pub env: HashMap<String, String>,
pub transpile_packages: Option<Vec<String>>,
}

Expand Down

0 comments on commit 91c0cf2

Please sign in to comment.