Skip to content

Commit

Permalink
Fix for storing more of the vars
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Sep 20, 2023
1 parent 447cfcb commit ae96117
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/GitHub/private/Initialize-SecretVault.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ function Initialize-SecretVault {
}
Register-SecretVault @secretVault
}
Get-SecretStoreConfiguration
}
26 changes: 20 additions & 6 deletions src/GitHub/private/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,31 @@ $script:Token = ''
$Script:Version = '2022-11-28'
$script:ContentType = 'application/vnd.github+json'

Initialize-SecretVault
$secrets = Get-SecretInfo -Vault 'SecretStore'

if ([string]::IsNullOrEmpty($script:Token)) {
$script:Token = $env:GH_TOKEN
}
if ([string]::IsNullOrEmpty($script:Token)) {
$script:Token = $env:GITHUB_TOKEN
}
if ([string]::IsNullOrEmpty($Script:Token)) {
Initialize-SecretVault
$secrets = Get-SecretInfo -Vault SecretStore
if ('GitHub.Token' -in $secrets.name) {
$script:Token = Get-Secret -Name 'GitHub.Token' -AsPlainText
}
if (([string]::IsNullOrEmpty($Script:Token)) -and ('GitHub.Token' -in $secrets.name)) {
$script:Token = Get-Secret -Name 'GitHub.Token' -AsPlainText
}

if (([string]::IsNullOrEmpty($script:Owner)) -and ('GitHub.Owner' -in $secrets.name)) {
$script:Owner = Get-Secret -Name 'GitHub.Owner' -AsPlainText
}

if (([string]::IsNullOrEmpty($script:Repo)) -and ('GitHub.Repo' -in $secrets.name)) {
$script:Repo = Get-Secret -Name 'GitHub.Repo' -AsPlainText
}

if (([string]::IsNullOrEmpty($script:APIBaseURI)) -and ('GitHub.APIBaseURI' -in $secrets.name)) {
$script:APIBaseURI = Get-Secret -Name 'GitHub.APIBaseURI' -AsPlainText
}

if (([string]::IsNullOrEmpty($script:Version)) -and ('GitHub.Version' -in $secrets.name)) {
$script:Version = Get-Secret -Name 'GitHub.Version' -AsPlainText
}

0 comments on commit ae96117

Please sign in to comment.