Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
Configure GHCR credentials in configure command (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanis committed Aug 10, 2022
1 parent 8c451a8 commit 33c7449
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Valet/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ public async Task<int> UpdateValetAsync(string? username = null, string? passwor
{
await _dockerService.VerifyDockerRunningAsync().ConfigureAwait(false);

var environmentVariables = await _configurationService.ReadCurrentVariablesAsync().ConfigureAwait(false);

username ??= Environment.GetEnvironmentVariable("GHCR_USERNAME");
password ??= Environment.GetEnvironmentVariable("GHCR_PASSWORD");

if (username == null)
environmentVariables.TryGetValue("GHCR_USERNAME", out username);

if (password == null)
environmentVariables.TryGetValue("GHCR_PASSWORD", out password);

await _dockerService.UpdateImageAsync(
ValetImage,
ValetContainerRegistry,
Expand Down
2 changes: 2 additions & 0 deletions src/Valet/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public static class Constants
{
private static readonly List<Variable> UserInputVariables = new()
{
new Variable("GHCR_USERNAME", Provider.GitHub, "GitHub handle used to authenticate with the GitHub Container Registry"),
new Variable("GHCR_PASSWORD", Provider.GitHub, "Personal access token to authenticate with the GitHub Container Registry"),
new Variable("GITHUB_ACCESS_TOKEN", Provider.GitHub, "Personal access token for GitHub"),
new Variable("GITHUB_INSTANCE_URL", Provider.GitHub, "Base url of the GitHub instance", "https://github.com"),
new Variable("AZURE_DEVOPS_ACCESS_TOKEN", Provider.AzureDevOps, "Personal access token for Azure DevOps"),
Expand Down

0 comments on commit 33c7449

Please sign in to comment.