refactor(registry): rename git config to be generic

This commit is contained in:
daimond113 2024-11-03 13:26:53 +01:00
parent fde2ba1021
commit 237d6e67e3
No known key found for this signature in database
GPG key ID: 3A8ECE51328B513C
3 changed files with 17 additions and 12 deletions

View file

@ -3,6 +3,8 @@ title: Self Hosting Registries
description: Learn how to self host registries for pesde. 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 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. 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). [pesde GitHub repository](https://github.com/daimond113/pesde/tree/0.5/registry).
Configuring the registry is done using environment variables. In order to allow 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 the registry to access the index repository, you must use an account that
token of a GitHub account that has access to the index repository. We recommend has access to the index repository. We recommend using a separate account
using a separate GitHub account for this purpose. for this purpose.
For instructions on how to create a personal access token, see the <Aside>
[GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). For a GitHub account the password **must** be a personal access token. 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. The access token must have read and write access to the index repository.
</Aside>
### General configuration ### General configuration
- **INDEX_REPO_URL**: The URL of the index repository. This is required.\ - **INDEX_REPO_URL**: The URL of the index repository. This is required.\
Example: `https://github.com/daimond113/pesde-index.git` 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. 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. `GITHUB_USERNAME`. This is required.
- **COMMITTER_GIT_NAME**: The name to use for the committer when updating the - **COMMITTER_GIT_NAME**: The name to use for the committer when updating the

View file

@ -1,7 +1,7 @@
INDEX_REPO_URL = # url of the index repository INDEX_REPO_URL = # url of the index repository
GITHUB_USERNAME= # username of github account with push access to the index repository GIT_USERNAME= # username of a Git account with push access to the index repository
GITHUB_PAT= # personal access token of github 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_NAME= # name of the committer used for index updates
COMMITTER_GIT_EMAIL= # email of the committer used for index updates COMMITTER_GIT_EMAIL= # email of the committer used for index updates

View file

@ -94,8 +94,8 @@ async fn run() -> std::io::Result<()> {
data_dir.join("project"), data_dir.join("project"),
&cwd, &cwd,
AuthConfig::new().with_git_credentials(Some(gix::sec::identity::Account { AuthConfig::new().with_git_credentials(Some(gix::sec::identity::Account {
username: benv!(required "GITHUB_USERNAME"), username: benv!(required "GIT_USERNAME"),
password: benv!(required "GITHUB_PAT"), password: benv!(required "GIT_PASSWORD"),
})), })),
); );
let source = PesdePackageSource::new(benv!(required "INDEX_REPO_URL").try_into().unwrap()); let source = PesdePackageSource::new(benv!(required "INDEX_REPO_URL").try_into().unwrap());