@@ -248,7 +248,7 @@ let app = vespera!(
248248 dir = " routes" , // Route folder name (default: "routes")
249249 openapi = " openapi.json" , // OpenAPI JSON file path (optional)
250250 title = " My API" , // API title (optional, default: "API")
251- version = " 1.0.0" , // API version (optional, default: "1.0.0" )
251+ version = " 1.0.0" , // API version (optional, default: Cargo.toml version )
252252 docs_url = " /docs" // Swagger UI documentation URL (optional)
253253);
254254```
@@ -268,13 +268,53 @@ let app = vespera!(
268268- ** ` title ` ** : API title (optional, default: ` "API" ` )
269269 - Used in the ` info.title ` field of the OpenAPI document
270270
271- - ** ` version ` ** : API version (optional, default: ` "1.0.0" ` )
271+ - ** ` version ` ** : API version (optional, default: your ` Cargo.toml ` version )
272272 - Used in the ` info.version ` field of the OpenAPI document
273+ - If not specified, automatically uses the version from your project's ` Cargo.toml ` (` CARGO_PKG_VERSION ` )
273274
274275- ** ` docs_url ` ** : Swagger UI documentation URL (optional)
275276 - If specified, you can view the API documentation through Swagger UI at that path
276277 - Example: Setting ` docs_url = "/docs" ` allows viewing documentation at ` http://localhost:3000/docs `
277278
279+ - ** ` redoc_url ` ** : ReDoc documentation URL (optional)
280+ - If specified, you can view the API documentation through ReDoc at that path
281+ - Example: Setting ` redoc_url = "/redoc" ` allows viewing documentation at ` http://localhost:3000/redoc `
282+
283+ #### Environment Variables
284+
285+ All macro parameters can also be configured via environment variables. Environment variables are used as fallbacks when the corresponding macro parameter is not specified.
286+
287+ | Macro Parameter | Environment Variable | Description |
288+ | -----------------| ---------------------| -------------|
289+ | ` dir ` | ` VESPERA_DIR ` | Route folder name |
290+ | ` openapi ` | ` VESPERA_OPENAPI ` | OpenAPI JSON file path |
291+ | ` title ` | ` VESPERA_TITLE ` | API title |
292+ | ` version ` | ` VESPERA_VERSION ` | API version |
293+ | ` docs_url ` | ` VESPERA_DOCS_URL ` | Swagger UI documentation URL |
294+ | ` redoc_url ` | ` VESPERA_REDOC_URL ` | ReDoc documentation URL |
295+
296+ ** Priority Order** (highest to lowest):
297+ 1 . Macro parameter (e.g., ` version = "1.0.0" ` )
298+ 2 . Environment variable (e.g., ` VESPERA_VERSION ` )
299+ 3 . ` CARGO_PKG_VERSION ` (for ` version ` only)
300+ 4 . Default value
301+
302+ ** Example:**
303+
304+ ``` bash
305+ # Set environment variables
306+ export VESPERA_TITLE=" My Production API"
307+ export VESPERA_VERSION=" 2.0.0"
308+ export VESPERA_DOCS_URL=" /api-docs"
309+ ```
310+
311+ ``` rust
312+ // These will use the environment variables as defaults
313+ let app = vespera! (
314+ openapi = " openapi.json"
315+ );
316+ ```
317+
278318### ` #[route] ` Attribute Macro
279319
280320Specify HTTP method and path for handler functions.
0 commit comments