Skip to content

Commit a404dbf

Browse files
committed
fix: use apiPublicBaseUrl to generate public url
1 parent 7a74be9 commit a404dbf

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/apify/src/configuration.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface ConfigurationOptions extends CoreConfigurationOptions {
1616
actorRunId?: string;
1717
actorTaskId?: string;
1818
apiBaseUrl?: string;
19+
apiPublicBaseUrl?: string;
1920
containerPort?: number;
2021
containerUrl?: string;
2122
proxyHostname?: string;
@@ -139,6 +140,7 @@ export class Configuration extends CoreConfiguration {
139140
APIFY_ACTOR_EVENTS_WS_URL: 'actorEventsWsUrl',
140141
APIFY_ACTOR_ID: 'actorId',
141142
APIFY_API_BASE_URL: 'apiBaseUrl',
143+
APIFY_API_PUBLIC_BASE_URL: 'apiPublicBaseUrl',
142144
APIFY_IS_AT_HOME: 'isAtHome',
143145
APIFY_ACTOR_RUN_ID: 'actorRunId',
144146
APIFY_ACTOR_TASK_ID: 'actorTaskId',
@@ -183,6 +185,7 @@ export class Configuration extends CoreConfiguration {
183185
defaultRequestQueueId: LOCAL_ACTOR_ENV_VARS[ACTOR_ENV_VARS.DEFAULT_REQUEST_QUEUE_ID],
184186
inputKey: 'INPUT',
185187
apiBaseUrl: 'https://api.apify.com',
188+
apiPublicBaseUrl: 'https://api.apify.com',
186189
proxyStatusUrl: 'http://proxy.apify.com',
187190
proxyHostname: LOCAL_APIFY_ENV_VARS[APIFY_ENV_VARS.PROXY_HOSTNAME],
188191
proxyPort: +LOCAL_APIFY_ENV_VARS[APIFY_ENV_VARS.PROXY_PORT],

packages/apify/src/key_value_store.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ export class KeyValueStore extends CoreKeyValueStore {
1616
* access the value in the remote key-value store.
1717
*/
1818
override getPublicUrl(key: string): string {
19-
if (!(this.config as Configuration).get('isAtHome') && getPublicUrl) {
19+
const config = this.config as Configuration;
20+
if (!config.get('isAtHome') && getPublicUrl) {
2021
return getPublicUrl.call(this, key);
2122
}
2223

23-
const publicUrl = new URL(`https://api.apify.com/v2/key-value-stores/${this.id}/records/${key}`);
24+
const publicUrl = new URL(`${config.get('apiPublicBaseUrl', 'https://api.apify.com')}/v2/key-value-stores/${this.id}/records/${key}`);
2425

2526
if (this.storageObject?.urlSigningSecretKey) {
2627
publicUrl.searchParams.append('signature', createHmacSignature(this.storageObject.urlSigningSecretKey as string, key));

0 commit comments

Comments
 (0)