Skip to content

Commit b07b43e

Browse files
feat: Turn configuration into a first-class concept for Pavex
1 parent 65ca31f commit b07b43e

File tree

344 files changed

+10205
-2602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

344 files changed

+10205
-2602
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -977,14 +977,7 @@ jobs:
977977
- name: Build API reference
978978
run: |
979979
cd libs
980-
cargo doc \
981-
--all-features \
982-
--package pavex \
983-
--package pavex_cli_client \
984-
--package pavex_session \
985-
--package pavex_session_sqlx \
986-
--package pavex_session_memory_store \
987-
--no-deps
980+
cargo api_ref
988981
- name: Copy API reference files
989982
run: |
990983
mkdir -p docs/api_reference
@@ -1001,7 +994,7 @@ jobs:
1001994
tags: pavex-docs
1002995
- name: Build docs
1003996
run: |
1004-
docker run --rm -v ${PWD}:/docs pavex-docs build
997+
docker run --rm -v ${PWD}:/docs pavex-docs build --strict
1005998
- uses: actions/upload-artifact@v4
1006999
with:
10071000
name: docs
@@ -1025,6 +1018,7 @@ jobs:
10251018
--exclude-path="site/api_reference/pavex/time"
10261019
--exclude-path="site/api_reference/help.html"
10271020
--exclude-path="site/api_reference/settings.html"
1021+
--exclude=".*crate#per-style$"
10281022
--exclude="https://doc.rust-lang.org/*"
10291023
--exclude="https://stackoverflow.com/*"
10301024
--exclude="https://github.com/LukeMathWalker/pavex/edit/main/*"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
trace-*.json
2121
/docs/api_reference/
2222
.direnv/
23+
site

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### ‼️ Breaking changes
1313

1414
- Finalize the API for `pavex_session`, the HTTP session implementation for Pavex.
15-
15+
1616
The previous API gave equal standing to client-side and server-side state manipulation,
1717
while the latter is to be preferred and likely to be more widely used.
1818
This change moves all server-related method to appear directly on the `Session`
1919
type, while client-side method remain on dedicated accessors.
2020
Capabilities are unchanged, but the user-experience should be more pleasant.
2121

2222
### 📚 Documentation
23+
2324
- Add [a guide on HTTP sessions](https://pavex.dev/docs/guide/sessions/) to pavex.dev (by @LukeMathWalker) - #463
2425

2526
### Contributors
2627

27-
* @LukeMathWalker
28+
- @LukeMathWalker
2829

2930
## [0.1.77](https://github.com/LukeMathWalker/pavex/compare/0.1.76...0.1.77) - 2025-02-26
3031

ci_utils/templates/job_steps/build_docs.jinja

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
- name: Build API reference
88
run: |
99
cd libs
10-
cargo doc \
11-
--all-features \
12-
--package pavex \
13-
--package pavex_cli_client \
14-
--package pavex_session \
15-
--package pavex_session_sqlx \
16-
--package pavex_session_memory_store \
17-
--no-deps
10+
cargo api_ref
1811
- name: Copy API reference files
1912
run: |
2013
mkdir -p docs/api_reference
@@ -31,7 +24,7 @@
3124
tags: pavex-docs
3225
- name: Build docs
3326
run: |
34-
docker run --rm -v ${PWD}:/docs pavex-docs build
27+
docker run --rm -v ${PWD}:/docs pavex-docs build --strict
3528
- uses: actions/upload-artifact@v4
3629
with:
3730
name: docs
@@ -55,6 +48,7 @@
5548
--exclude-path="site/api_reference/pavex/time"
5649
--exclude-path="site/api_reference/help.html"
5750
--exclude-path="site/api_reference/settings.html"
51+
--exclude=".*crate#per-style$"
5852
--exclude="https://doc.rust-lang.org/*"
5953
--exclude="https://stackoverflow.com/*"
6054
--exclude="https://github.com/LukeMathWalker/pavex/edit/main/*"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```rust title="server_sdk/src/lib.rs"
2+
// [...]
3+
pub struct ApplicationConfig {
4+
pub database: configuration::base::DatabaseConfig,
5+
pub server: configuration::server::ServerConfig,
6+
}
7+
```

doc_examples/guide/configuration/01.patch

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
```rust title="src/base/config.rs" hl_lines="3"
2+
use secrecy::Secret;
3+
4+
#[derive(serde::Deserialize, Debug, Clone)]
5+
pub struct DatabaseConfig {
6+
pub username: String,
7+
pub password: Secret<String>,
8+
pub host: String,
9+
pub database_name: String,
10+
pub require_ssl: bool,
11+
}
12+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
```rust title="src/postgres.rs"
2+
use secrecy::Secret;
3+
4+
#[derive(serde::Deserialize, Debug, Clone)]
5+
pub struct PostgresConfig {
6+
pub pool: PoolConfig,
7+
pub connection: ConnectionConfig,
8+
}
9+
10+
#[derive(serde::Deserialize, Debug, Clone)]
11+
pub struct ConnectionConfig {
12+
pub username: String,
13+
pub password: Secret<String>,
14+
pub host: String,
15+
pub database_name: String,
16+
pub require_ssl: bool,
17+
}
18+
19+
#[derive(serde::Deserialize, Debug, Clone)]
20+
pub struct PoolConfig {
21+
pub min_size: u32,
22+
pub max_size: u32,
23+
}
24+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```rust title="src/postgres.rs"
2+
// [...]
3+
bp.config("postgres", t!(self::PostgresConfig));
4+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
```rust title="src/base/profile.rs"
2+
pub use pavex::config::ConfigProfile;
3+
4+
#[derive(ConfigProfile)] // (1)!
5+
pub enum Profile {
6+
#[pavex(profile = "dev")]
7+
Development,
8+
#[pavex(profile = "prod")]
9+
Production,
10+
}
11+
```

0 commit comments

Comments
 (0)