Skip to content

Commit 39773c5

Browse files
authored
Merge pull request #15 from dev-five-git/macro-option-with-env
Add env
2 parents 842afeb + 7a6aa77 commit 39773c5

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"changes":{"crates/vespera_core/Cargo.toml":"Patch","crates/vespera_macro/Cargo.toml":"Patch","crates/vespera/Cargo.toml":"Patch"},"note":"Set macro option by env value","date":"2025-12-03T01:39:38.071244800Z"}

crates/vespera_macro/src/lib.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,31 @@ impl Parse for AutoRouterInput {
121121
}
122122

123123
Ok(AutoRouterInput {
124-
dir,
125-
openapi,
126-
title,
127-
version,
128-
docs_url,
124+
dir: dir.or_else(|| {
125+
std::env::var("VESPERA_DIR")
126+
.map(|f| LitStr::new(&f, Span::call_site()))
127+
.ok()
128+
}),
129+
openapi: openapi.or_else(|| {
130+
std::env::var("VESPERA_OPENAPI")
131+
.map(|f| LitStr::new(&f, Span::call_site()))
132+
.ok()
133+
}),
134+
title: title.or_else(|| {
135+
std::env::var("VESPERA_TITLE")
136+
.map(|f| LitStr::new(&f, Span::call_site()))
137+
.ok()
138+
}),
139+
version: version.or_else(|| {
140+
std::env::var("VESPERA_VERSION")
141+
.map(|f| LitStr::new(&f, Span::call_site()))
142+
.ok()
143+
}),
144+
docs_url: docs_url.or_else(|| {
145+
std::env::var("VESPERA_DOCS_URL")
146+
.map(|f| LitStr::new(&f, Span::call_site()))
147+
.ok()
148+
}),
129149
})
130150
}
131151
}

0 commit comments

Comments
 (0)