Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2228da6

Browse filesBrowse files
Merge pull request #192 from theseus-rs/add-bundled-docs
chore: add documentation for bundled feature flag
2 parents 9df95c6 + 43de5ce commit 2228da6
Copy full SHA for 2228da6

File tree

Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed

‎postgresql_embedded/README.md

Copy file name to clipboardExpand all lines: postgresql_embedded/README.md
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,30 @@ The following features are available:
110110
| `tokio` | Enables using tokio for async | No |
111111
| `zonky` | Enables zonky PostgreSQL binaries | No |
112112

113+
## Bundling PostgreSQL
114+
115+
To bundle PostgreSQL with your application, you can enable the `bundled` feature. This will download the PostgreSQL
116+
archive at compile time and include it in your binary. You should specify the version of PostgreSQL to bundle by
117+
setting the environment variable `POSTGRESQL_VERSION` to a specific version, e.g. `=17.2.0`. In order to use the bundled
118+
PostgreSQL, you will also need to set an explicit matching version at runtime in `Settings`:
119+
120+
```rust
121+
use postgresql_embedded::{Result, Settings, VersionReq};
122+
123+
#[tokio::main]
124+
async fn main() -> Result<()> {
125+
let settings = Settings {
126+
version: VersionReq::from_str("=17.2.0")?,
127+
..Default::default()
128+
};
129+
Ok(())
130+
}
131+
```
132+
133+
The PostgreSQL binaries can also be obtained from a different GitHub source by setting the `POSTGRESQL_RELEASES_URL`
134+
environment variable. The repository must contain the releases with archives in same structure as
135+
[theseus-rs/postgresql_binaries](https://github.com/theseus-rs/postgresql-binaries).
136+
113137
## Safety
114138

115139
This crate uses `#![forbid(unsafe_code)]` to ensure everything is implemented in 100% safe Rust.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.