File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Original file line number Diff line number Diff line change @@ -110,6 +110,30 @@ The following features are available:
110
110
| ` tokio ` | Enables using tokio for async | No |
111
111
| ` zonky ` | Enables zonky PostgreSQL binaries | No |
112
112
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
+
113
137
## Safety
114
138
115
139
This crate uses ` #![forbid(unsafe_code)] ` to ensure everything is implemented in 100% safe Rust.
You can’t perform that action at this time.
0 commit comments