Skip to content

Commit

Permalink
chore: separate update and delete password
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderleegs committed Jun 27, 2023
1 parent 323f364 commit 592ab87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
31 changes: 13 additions & 18 deletions src/services/identity/DeploymentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,27 +90,22 @@ class DeploymentClient {
},
})

generateDeletePasswordInput = (appId: string): UpdateBranchCommandInput => ({
appId,
branchName: "staging",
enableBasicAuth: false,
basicAuthCredentials: "",
})

generateUpdatePasswordInput = (
appId: string,
password: string
): UpdateBranchCommandInput => {
if (password) {
return {
appId,
branchName: "staging",
enableBasicAuth: true,
basicAuthCredentials: Buffer.from(`user:${password}`).toString(
"base64"
),
}
}
return {
appId,
branchName: "staging",
enableBasicAuth: false,
basicAuthCredentials: "",
}
}
): UpdateBranchCommandInput => ({
appId,
branchName: "staging",
enableBasicAuth: true,
basicAuthCredentials: Buffer.from(`user:${password}`).toString("base64"),
})
}

export default DeploymentClient
5 changes: 1 addition & 4 deletions src/services/identity/DeploymentsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ class DeploymentsService {
const { id, hostingId: appId } = deploymentInfo
let updateAppInput
if (!enablePassword) {
updateAppInput = this.deploymentClient.generateUpdatePasswordInput(
appId,
""
)
updateAppInput = this.deploymentClient.generateDeletePasswordInput(appId)
} else {
const {
encryptedPassword: oldEncryptedPassword,
Expand Down

0 comments on commit 592ab87

Please sign in to comment.