Skip to content

Commit

Permalink
feat(keygen): set host in config
Browse files Browse the repository at this point in the history
  • Loading branch information
hrueger committed Nov 27, 2024
1 parent 6a6bed4 commit 6975c1b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/app-builder-lib/scheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,10 @@
"default": "stable",
"description": "The channel."
},
"host": {
"description": "Keygen host",
"type": "string"
},
"platform": {
"description": "The target Platform. Is set programmatically explicitly during publishing.",
"type": [
Expand Down
5 changes: 5 additions & 0 deletions packages/builder-util-runtime/src/publishOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ export interface KeygenOptions extends PublishConfiguration {
*/
readonly provider: "keygen"

/**
* Keygen host
*/
readonly host?: string

/**
* Keygen account's UUID
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/electron-publish/src/keygenPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface KeygenArtifact {

export class KeygenPublisher extends HttpPublisher {
readonly providerName = "keygen"
readonly hostname = "api.keygen.sh"
readonly hostname: string = "api.keygen.sh"

private readonly info: KeygenOptions
private readonly auth: string
Expand All @@ -96,6 +96,7 @@ export class KeygenPublisher extends HttpPublisher {
}

this.info = info
if (info.host) this.hostname = info.host
this.auth = `Bearer ${token.trim()}`
this.version = version
this.basePath = `/v1/accounts/${this.info.account}`
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/src/providers/KeygenProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class KeygenProvider extends Provider<UpdateInfo> {
...runtimeOptions,
isUseMultipleRangeRequest: false,
})
this.baseUrl = newBaseUrl(`https://api.keygen.sh/v1/accounts/${this.configuration.account}/artifacts?product=${this.configuration.product}`)
this.baseUrl = newBaseUrl(`https://${this.configuration.host || "api.keygen.sh"}/v1/accounts/${this.configuration.account}/artifacts?product=${this.configuration.product}`)
}

private get channel(): string {
Expand Down

0 comments on commit 6975c1b

Please sign in to comment.