-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
From
impl to convert db config to ConnectOptions (#240)
Add `From<Database>` impl for `ConnectOptions` to encapsulate the conversion, which would make it easier if a consumer wants to override the default `App#db_connection_options` method but keep some of our defaults.
- Loading branch information
1 parent
ef6e630
commit 46c9611
Showing
3 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...napshots/roadster__config__database__deserialize_tests__db_config_to_connect_options.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
source: src/config/database/mod.rs | ||
expression: connect_options | ||
--- | ||
ConnectOptions { | ||
url: "postgres://example:example@example:1234/example_app", | ||
max_connections: Some( | ||
20, | ||
), | ||
min_connections: Some( | ||
10, | ||
), | ||
connect_timeout: Some( | ||
1s, | ||
), | ||
idle_timeout: Some( | ||
3s, | ||
), | ||
acquire_timeout: Some( | ||
2s, | ||
), | ||
max_lifetime: Some( | ||
4s, | ||
), | ||
sqlx_logging: false, | ||
sqlx_logging_level: Info, | ||
sqlx_slow_statements_logging_level: Off, | ||
sqlx_slow_statements_logging_threshold: 1s, | ||
sqlcipher_key: None, | ||
schema_search_path: None, | ||
test_before_acquire: true, | ||
} |