diff --git a/README.md b/README.md index fac51c2..5ea3b65 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/postgresql_archive/tests/zonky.rs b/postgresql_archive/tests/zonky.rs index 174f5ec..8ee54b2 100644 --- a/postgresql_archive/tests/zonky.rs +++ b/postgresql_archive/tests/zonky.rs @@ -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(()) } diff --git a/postgresql_embedded/Cargo.toml b/postgresql_embedded/Cargo.toml index 7051be4..74971e2 100644 --- a/postgresql_embedded/Cargo.toml +++ b/postgresql_embedded/Cargo.toml @@ -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 } diff --git a/postgresql_embedded/build/bundle.rs b/postgresql_embedded/build/bundle.rs index b0f332f..79af84d 100644 --- a/postgresql_embedded/build/bundle.rs +++ b/postgresql_embedded/build/bundle.rs @@ -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 @@ -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())?; @@ -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(()) +}