File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
Filter options
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.
30
30
- ability to configure PostgreSQL startup options
31
31
- URL based configuration
32
32
- choice of native-tls vs rustls
33
+ - support for installing PostgreSQL extensions
33
34
34
35
## Getting Started
35
36
Original file line number Diff line number Diff line change @@ -45,11 +45,11 @@ async fn test_get_archive_and_extract() -> anyhow::Result<()> {
45
45
#[ cfg( all( target_os = "linux" , target_arch = "x86_64" ) ) ]
46
46
assert_eq ! ( 1_023 , files. len( ) ) ;
47
47
#[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
48
- assert_eq ! ( 1_019 , files. len( ) ) ;
48
+ assert_eq ! ( 1_021 , files. len( ) ) ;
49
49
#[ cfg( all( target_os = "macos" , target_arch = "x86_64" ) ) ]
50
- assert_eq ! ( 1_019 , files. len( ) ) ;
50
+ assert_eq ! ( 1_021 , files. len( ) ) ;
51
51
#[ cfg( all( target_os = "windows" , target_arch = "x86_64" ) ) ]
52
- assert_eq ! ( 1_019 , files. len( ) ) ;
52
+ assert_eq ! ( 1_021 , files. len( ) ) ;
53
53
remove_dir_all ( & out_dir) ?;
54
54
Ok ( ( ) )
55
55
}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ anyhow = { workspace = true }
15
15
postgresql_archive = { path = " ../postgresql_archive" , version = " 0.16.3" , default-features = false }
16
16
target-triple = { workspace = true }
17
17
tokio = { workspace = true , features = [" full" ] }
18
+ url = { workspace = true }
18
19
19
20
[dependencies ]
20
21
anyhow = { workspace = true }
Original file line number Diff line number Diff line change 1
1
#![ allow( dead_code) ]
2
2
3
3
use anyhow:: Result ;
4
- use postgresql_archive:: get_archive ;
4
+ use postgresql_archive:: repository :: github :: repository :: GitHub ;
5
5
use postgresql_archive:: VersionReq ;
6
+ use postgresql_archive:: { get_archive, repository} ;
6
7
use std:: fs:: File ;
7
8
use std:: io:: Write ;
8
9
use std:: path:: PathBuf ;
9
10
use std:: str:: FromStr ;
10
11
use std:: { env, fs} ;
12
+ use url:: Url ;
11
13
12
14
/// Stage the PostgreSQL archive when the `bundled` feature is enabled so that
13
15
/// 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<()> {
38
40
return Ok ( ( ) ) ;
39
41
}
40
42
43
+ register_github_repository ( ) ?;
41
44
let ( asset_version, archive) = get_archive ( & releases_url, & version_req) . await ?;
42
45
43
46
fs:: write ( archive_version_file. clone ( ) , asset_version. to_string ( ) ) ?;
@@ -48,3 +51,15 @@ pub(crate) async fn stage_postgresql_archive() -> Result<()> {
48
51
49
52
Ok ( ( ) )
50
53
}
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