From 237d6e67e31f72d39bba8024a6b584040b1a088c Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:26:53 +0100 Subject: [PATCH] refactor(registry): rename git config to be generic --- .../docs/guides/self-hosting-registries.mdx | 21 ++++++++++++------- registry/.env.example | 4 ++-- registry/src/main.rs | 4 ++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/src/content/docs/guides/self-hosting-registries.mdx b/docs/src/content/docs/guides/self-hosting-registries.mdx index dc8c3bf..7c92a06 100644 --- a/docs/src/content/docs/guides/self-hosting-registries.mdx +++ b/docs/src/content/docs/guides/self-hosting-registries.mdx @@ -3,6 +3,8 @@ title: Self Hosting Registries description: Learn how to self host registries for pesde. --- +import { Aside } from "@astrojs/starlight/components" + You can self host registries for pesde. This is useful if you want a private registry or if you a separate registry for other reasons. @@ -81,23 +83,26 @@ The official registry implementation is available in the [pesde GitHub repository](https://github.com/daimond113/pesde/tree/0.5/registry). Configuring the registry is done using environment variables. In order to allow -the registry to access the index repository, you must use a personal access -token of a GitHub account that has access to the index repository. We recommend -using a separate GitHub account for this purpose. +the registry to access the index repository, you must use an account that +has access to the index repository. We recommend using a separate account +for this purpose. -For instructions on how to create a personal access token, see the -[GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). -The access token must have read and write access to the index repository. + ### General configuration - **INDEX_REPO_URL**: The URL of the index repository. This is required.\ Example: `https://github.com/daimond113/pesde-index.git` -- **GITHUB_USERNAME**: The username of the GitHub account that has access to the +- **GIT_USERNAME**: The username of a Git account that has push access to the index repository. This is required. -- **GITHUB_PAT**: The personal access token of the GitHub account specified by +- **GIT_PASSWORD**: The password of the account specified by `GITHUB_USERNAME`. This is required. - **COMMITTER_GIT_NAME**: The name to use for the committer when updating the diff --git a/registry/.env.example b/registry/.env.example index b0716b1..f4600d1 100644 --- a/registry/.env.example +++ b/registry/.env.example @@ -1,7 +1,7 @@ INDEX_REPO_URL = # url of 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 +GIT_USERNAME= # username of a Git account with push access to the index repository +GIT_PASSWORD= # password of the account (PAT for GitHub) COMMITTER_GIT_NAME= # name of the committer used for index updates COMMITTER_GIT_EMAIL= # email of the committer used for index updates diff --git a/registry/src/main.rs b/registry/src/main.rs index 8b0891e..faca878 100644 --- a/registry/src/main.rs +++ b/registry/src/main.rs @@ -94,8 +94,8 @@ async fn run() -> std::io::Result<()> { data_dir.join("project"), &cwd, AuthConfig::new().with_git_credentials(Some(gix::sec::identity::Account { - username: benv!(required "GITHUB_USERNAME"), - password: benv!(required "GITHUB_PAT"), + username: benv!(required "GIT_USERNAME"), + password: benv!(required "GIT_PASSWORD"), })), ); let source = PesdePackageSource::new(benv!(required "INDEX_REPO_URL").try_into().unwrap());