File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ In either case, PostgreSQL will run in a separate process space.
3030- ability to configure PostgreSQL startup options
3131- URL based configuration
3232- choice of native-tls vs rustls
33+ - support for installing PostgreSQL extensions
3334
3435## Getting Started
3536
Original file line number Diff line number Diff line change @@ -45,11 +45,11 @@ async fn test_get_archive_and_extract() -> anyhow::Result<()> {
4545 #[ cfg( all( target_os = "linux" , target_arch = "x86_64" ) ) ]
4646 assert_eq ! ( 1_023 , files. len( ) ) ;
4747 #[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
48- assert_eq ! ( 1_019 , files. len( ) ) ;
48+ assert_eq ! ( 1_021 , files. len( ) ) ;
4949 #[ cfg( all( target_os = "macos" , target_arch = "x86_64" ) ) ]
50- assert_eq ! ( 1_019 , files. len( ) ) ;
50+ assert_eq ! ( 1_021 , files. len( ) ) ;
5151 #[ cfg( all( target_os = "windows" , target_arch = "x86_64" ) ) ]
52- assert_eq ! ( 1_019 , files. len( ) ) ;
52+ assert_eq ! ( 1_021 , files. len( ) ) ;
5353 remove_dir_all ( & out_dir) ?;
5454 Ok ( ( ) )
5555}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ anyhow = { workspace = true }
1515postgresql_archive = { path = " ../postgresql_archive" , version = " 0.16.3" , default-features = false }
1616target-triple = { workspace = true }
1717tokio = { workspace = true , features = [" full" ] }
18+ url = { workspace = true }
1819
1920[dependencies ]
2021anyhow = { workspace = true }
Original file line number Diff line number Diff line change 11#![ allow( dead_code) ]
22
33use anyhow:: Result ;
4- use postgresql_archive:: get_archive ;
4+ use postgresql_archive:: repository :: github :: repository :: GitHub ;
55use postgresql_archive:: VersionReq ;
6+ use postgresql_archive:: { get_archive, repository} ;
67use std:: fs:: File ;
78use std:: io:: Write ;
89use std:: path:: PathBuf ;
910use std:: str:: FromStr ;
1011use std:: { env, fs} ;
12+ use url:: Url ;
1113
1214/// Stage the PostgreSQL archive when the `bundled` feature is enabled so that
1315/// 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<()> {
3840 return Ok ( ( ) ) ;
3941 }
4042
43+ register_github_repository ( ) ?;
4144 let ( asset_version, archive) = get_archive ( & releases_url, & version_req) . await ?;
4245
4346 fs:: write ( archive_version_file. clone ( ) , asset_version. to_string ( ) ) ?;
@@ -48,3 +51,15 @@ pub(crate) async fn stage_postgresql_archive() -> Result<()> {
4851
4952 Ok ( ( ) )
5053}
54+
55+ fn register_github_repository ( ) -> Result < ( ) > {
56+ repository:: registry:: register (
57+ |url| {
58+ let parsed_url = Url :: parse ( url) ?;
59+ let host = parsed_url. host_str ( ) . unwrap_or_default ( ) ;
60+ Ok ( host. ends_with ( "github.com" ) )
61+ } ,
62+ Box :: new ( GitHub :: new) ,
63+ ) ?;
64+ Ok ( ( ) )
65+ }
You can’t perform that action at this time.
0 commit comments