feat(registry): use env variable for repo

This commit is contained in:
daimond113 2024-09-04 16:19:09 +02:00
parent d321b8b0aa
commit c08dfb9965
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
3 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,5 @@
INDEX_REPO_URL = # url of the index repository
GITHUB_USERNAME= # username of github account with push access to the index repository GITHUB_USERNAME= # username of github account with push access to the index repository
GITHUB_PAT= # personal access token of github account with push access to the index repository GITHUB_PAT= # personal access token of github account with push access to the index repository

View file

@ -288,10 +288,10 @@ pub async fn publish_package(
DependencySpecifiers::Pesde(specifier) => { DependencySpecifiers::Pesde(specifier) => {
if specifier if specifier
.index .index
.as_ref() .as_deref()
.filter(|index| match index.parse::<url::Url>() { .filter(|index| match gix::Url::try_from(*index) {
Ok(_) if config.other_registries_allowed => true, Ok(_) if config.other_registries_allowed => true,
Ok(url) => url == env!("CARGO_PKG_REPOSITORY").parse().unwrap(), Ok(url) => url == *source.repo_url(),
Err(_) => false, Err(_) => false,
}) })
.is_none() .is_none()

View file

@ -85,7 +85,7 @@ async fn run(with_sentry: bool) -> std::io::Result<()> {
password: benv!(required "GITHUB_PAT"), password: benv!(required "GITHUB_PAT"),
})), })),
); );
let source = PesdePackageSource::new(env!("CARGO_PKG_REPOSITORY").try_into().unwrap()); let source = PesdePackageSource::new(benv!(required "INDEX_REPO_URL").try_into().unwrap());
source.refresh(&project).expect("failed to refresh source"); source.refresh(&project).expect("failed to refresh source");
let (search_reader, search_writer) = make_search(&project, &source); let (search_reader, search_writer) = make_search(&project, &source);