11#![ allow( dead_code) ]
22
33use anyhow:: Result ;
4- use postgresql_archive:: configuration:: custom;
4+ use postgresql_archive:: configuration:: { custom, theseus } ;
55use postgresql_archive:: repository:: github:: repository:: GitHub ;
66use postgresql_archive:: { VersionReq , matcher} ;
77use postgresql_archive:: { get_archive, repository} ;
@@ -24,10 +24,13 @@ pub(crate) async fn stage_postgresql_archive() -> Result<()> {
2424
2525 let releases_url = match env:: var ( "POSTGRESQL_RELEASES_URL" ) {
2626 Ok ( custom_url) if !default_releases_url. is_empty ( ) => {
27- register_github_repository ( ) ?;
27+ register_custom_repository ( ) ?;
2828 custom_url
2929 }
30- _ => default_releases_url,
30+ _ => {
31+ register_theseus_repository ( ) ?;
32+ default_releases_url
33+ }
3134 } ;
3235 println ! ( "PostgreSQL releases URL: {releases_url}" ) ;
3336 let postgres_version_req = env:: var ( "POSTGRESQL_VERSION" ) . unwrap_or ( "*" . to_string ( ) ) ;
@@ -65,8 +68,14 @@ fn supports_github_url(url: &str) -> postgresql_archive::Result<bool> {
6568 Ok ( host. ends_with ( "github.com" ) )
6669}
6770
68- fn register_github_repository ( ) -> Result < ( ) > {
71+ fn register_custom_repository ( ) -> Result < ( ) > {
72+ repository:: registry:: register ( supports_github_url, Box :: new ( GitHub :: new) ) ?;
73+ matcher:: registry:: register ( supports_github_url, custom:: matcher) ?;
74+ Ok ( ( ) )
75+ }
76+
77+ fn register_theseus_repository ( ) -> Result < ( ) > {
6978 repository:: registry:: register ( supports_github_url, Box :: new ( GitHub :: new) ) ?;
70- matcher:: registry:: register ( supports_github_url, custom :: matcher :: matcher) ?;
79+ matcher:: registry:: register ( supports_github_url, theseus :: matcher) ?;
7180 Ok ( ( ) )
7281}
0 commit comments