Skip to content

Commit

Permalink
removed JSONServiceAccountKey + JSONServiceAccountKeyPath parameters …
Browse files Browse the repository at this point in the history
…due to not being needed
  • Loading branch information
scrthq committed Feb 28, 2020
1 parent 466398a commit 63ee83f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 32 deletions.
18 changes: 8 additions & 10 deletions PSGSuite/Public/Configuration/Get-PSGSuiteConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,27 @@ function Get-PSGSuiteConfig {
'P12Key',
@{l = 'P12KeyPassword';e = {Decrypt $_.P12KeyPassword}},
@{l = 'P12KeyObject';e = {Decrypt $_.P12KeyObject}},
@{l = 'JSONServiceAccountKeyPath';e = {Decrypt $_.JSONServiceAccountKeyPath}},
@{l = 'JSONServiceAccountKey';e = {Decrypt $_.JSONServiceAccountKey}},
@{l = 'ClientSecretsPath';e = {Decrypt $_.ClientSecretsPath}},
@{l = 'ClientSecrets';e = {Decrypt $_.ClientSecrets}},
@{l = 'AppEmail';e = {
if ($_.JSONServiceAccountKey) {
($_.JSONServiceAccountKey | ConvertFrom-Json).client_email
if ($_.AppEmail) {
Decrypt $_.ServiceAccountClientID
}
else {
Decrypt $_.AppEmail
elseif ($_.ClientSecrets) {
(Decrypt $_.ClientSecrets | ConvertFrom-Json).client_email
}
}},
@{l = 'AdminEmail';e = {Decrypt $_.AdminEmail}},
@{l = 'CustomerID';e = {Decrypt $_.CustomerID}},
@{l = 'Domain';e = {Decrypt $_.Domain}},
@{l = 'Preference';e = {Decrypt $_.Preference}},
@{l = 'ServiceAccountClientID';e = {
if ($_.JSONServiceAccountKey) {
($_.JSONServiceAccountKey | ConvertFrom-Json).client_id
}
else {
if ($_.ServiceAccountClientID) {
Decrypt $_.ServiceAccountClientID
}
elseif ($_.ClientSecrets) {
(Decrypt $_.ClientSecrets | ConvertFrom-Json).client_id
}
}},
@{l = 'Chat';e = {
$dict = @{
Expand Down
24 changes: 2 additions & 22 deletions PSGSuite/Public/Configuration/Set-PSGSuiteConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ function Set-PSGSuiteConfig {
.PARAMETER P12KeyPassword
The password for the P12 Key file. If not specified the default of 'notasecret' will be used and this config value will not be set. This is only needed in the case where the P12 file has been manually rexported with a custom password
.PARAMETER JSONServiceAccountKeyPath
The path to the Service Account JSON file downloaded from the Google Developer's Console.
.PARAMETER JSONServiceAccountKey
The string contents of the Serivce Account JSON file downloaded from the Google Developer's Console.
.PARAMETER ClientSecretsPath
The path to the Client Secrets JSON file downloaded from the Google Developer's Console. Using the ClientSecrets JSON will prompt the user to complete OAuth2 authentication in their browser on the first run and store the retrieved Refresh and Access tokens in the user's home directory. The config will auto-update with this value after running any command, if ClientSecretsPath is filled and this value is not already present. If JSONServiceAccountKeyPath or P12KeyPath is also specified, ClientSecretsPath will be ignored.
Expand Down Expand Up @@ -108,12 +102,6 @@ function Set-PSGSuiteConfig {
$P12KeyPassword,
[parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)]
[string]
$JSONServiceAccountKeyPath,
[parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)]
[string]
$JSONServiceAccountKey,
[parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)]
[string]
$ClientSecretsPath,
[parameter(Mandatory = $false,ValueFromPipelineByPropertyName = $true)]
[string]
Expand Down Expand Up @@ -185,7 +173,7 @@ function Set-PSGSuiteConfig {
}
}
Write-Verbose "Setting config name '$ConfigName'"
$configParams = @('P12Key','P12KeyPath','P12KeyPassword','JSONServiceAccountKeyPath','JSONServiceAccountKey','ClientSecretsPath','ClientSecrets','AppEmail','AdminEmail','CustomerID','Domain','Preference','ServiceAccountClientID','Webhook','Space')
$configParams = @('P12Key','P12KeyPath','P12KeyPassword','ClientSecretsPath','ClientSecrets','AppEmail','AdminEmail','CustomerID','Domain','Preference','ServiceAccountClientID','Webhook','Space')
if ($SetAsDefaultConfig -or !$configHash["DefaultConfig"]) {
$configHash["DefaultConfig"] = $ConfigName
}
Expand All @@ -212,15 +200,7 @@ function Set-PSGSuiteConfig {
}
}
P12KeyPassword {
if (-not [System.String]""::IsNullOrWhiteSpace($PSBoundParameters[$key].Trim())) {
$configHash["$ConfigName"][$key] = (Encrypt $PSBoundParameters[$key])
}
}
JSONServiceAccountKeyPath {
if (-not [System.String]::IsNullOrWhiteSpace($PSBoundParameters[$key].Trim())) {
$configHash["$ConfigName"][$key] = (Encrypt $PSBoundParameters[$key])
$configHash["$ConfigName"]['JSONServiceAccountKey'] = (Encrypt $(Get-Content $PSBoundParameters[$key] -Raw))
}
$configHash["$ConfigName"][$key] = $PSBoundParameters[$key]
}
ClientSecretsPath {
if (-not [System.String]::IsNullOrWhiteSpace($PSBoundParameters[$key].Trim())) {
Expand Down

0 comments on commit 63ee83f

Please sign in to comment.