Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ In either case, PostgreSQL will run in a separate process space.
- ability to configure PostgreSQL startup options
- URL based configuration
- choice of native-tls vs rustls
- support for installing PostgreSQL extensions

## Getting Started

Expand Down
6 changes: 3 additions & 3 deletions postgresql_archive/tests/zonky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ async fn test_get_archive_and_extract() -> anyhow::Result<()> {
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
assert_eq!(1_023, files.len());
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
assert_eq!(1_019, files.len());
assert_eq!(1_021, files.len());
#[cfg(all(target_os = "macos", target_arch = "x86_64"))]
assert_eq!(1_019, files.len());
assert_eq!(1_021, files.len());
#[cfg(all(target_os = "windows", target_arch = "x86_64"))]
assert_eq!(1_019, files.len());
assert_eq!(1_021, files.len());
remove_dir_all(&out_dir)?;
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions postgresql_embedded/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ anyhow = { workspace = true }
postgresql_archive = { path = "../postgresql_archive", version = "0.16.3", default-features = false }
target-triple = { workspace = true }
tokio = { workspace = true, features = ["full"] }
url = { workspace = true }

[dependencies]
anyhow = { workspace = true }
Expand Down
17 changes: 16 additions & 1 deletion postgresql_embedded/build/bundle.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#![allow(dead_code)]

use anyhow::Result;
use postgresql_archive::get_archive;
use postgresql_archive::repository::github::repository::GitHub;
use postgresql_archive::VersionReq;
use postgresql_archive::{get_archive, repository};
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::str::FromStr;
use std::{env, fs};
use url::Url;

/// Stage the PostgreSQL archive when the `bundled` feature is enabled so that
/// it can be included in the final binary. This is useful for creating a
Expand Down Expand Up @@ -38,6 +40,7 @@ pub(crate) async fn stage_postgresql_archive() -> Result<()> {
return Ok(());
}

register_github_repository()?;
let (asset_version, archive) = get_archive(&releases_url, &version_req).await?;

fs::write(archive_version_file.clone(), asset_version.to_string())?;
Expand All @@ -48,3 +51,15 @@ pub(crate) async fn stage_postgresql_archive() -> Result<()> {

Ok(())
}

fn register_github_repository() -> Result<()> {
repository::registry::register(
|url| {
let parsed_url = Url::parse(url)?;
let host = parsed_url.host_str().unwrap_or_default();
Ok(host.ends_with("github.com"))
},
Box::new(GitHub::new),
)?;
Ok(())
}