mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 22:16:08 +00:00
fix: only cache config on cf workers
This commit is contained in:
parent
b0e10fd4a9
commit
285ec140a0
@ -100,7 +100,7 @@ export class BaseClient {
|
|||||||
options: BaseClientOptions;
|
options: BaseClientOptions;
|
||||||
|
|
||||||
/**@internal */
|
/**@internal */
|
||||||
static _seyfertConfig?: InternalRuntimeConfigHTTP | InternalRuntimeConfig;
|
static _seyfertCfWorkerConfig?: InternalRuntimeConfigHTTP | InternalRuntimeConfig;
|
||||||
|
|
||||||
constructor(options?: BaseClientOptions) {
|
constructor(options?: BaseClientOptions) {
|
||||||
this.options = MergeOptions(
|
this.options = MergeOptions(
|
||||||
@ -384,7 +384,7 @@ export class BaseClient {
|
|||||||
async getRC<
|
async getRC<
|
||||||
T extends InternalRuntimeConfigHTTP | InternalRuntimeConfig = InternalRuntimeConfigHTTP | InternalRuntimeConfig,
|
T extends InternalRuntimeConfigHTTP | InternalRuntimeConfig = InternalRuntimeConfigHTTP | InternalRuntimeConfig,
|
||||||
>() {
|
>() {
|
||||||
const seyfertConfig = (BaseClient._seyfertConfig ||
|
const seyfertConfig = (BaseClient._seyfertCfWorkerConfig ||
|
||||||
(await this.options?.getRC?.()) ||
|
(await this.options?.getRC?.()) ||
|
||||||
(await Promise.any(
|
(await Promise.any(
|
||||||
['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'].map(ext =>
|
['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'].map(ext =>
|
||||||
@ -407,8 +407,6 @@ export class BaseClient {
|
|||||||
output: join(process.cwd(), locations.output),
|
output: join(process.cwd(), locations.output),
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseClient._seyfertConfig = seyfertConfig;
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ export const config = {
|
|||||||
port: 8080,
|
port: 8080,
|
||||||
...data,
|
...data,
|
||||||
} as InternalRuntimeConfigHTTP;
|
} as InternalRuntimeConfigHTTP;
|
||||||
if (isCloudfareWorker()) BaseClient._seyfertConfig = obj;
|
if (isCloudfareWorker()) BaseClient._seyfertCfWorkerConfig = obj;
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user