fix(proxy): reload routes after SmartProxy startup
This commit is contained in:
@@ -179,7 +179,7 @@ export class SmartProxyManager {
|
|||||||
|
|
||||||
await this.waitForReady();
|
await this.waitForReady();
|
||||||
this.serviceRunning = true;
|
this.serviceRunning = true;
|
||||||
await this.reloadConfig();
|
await this.reloadConfig({ skipRunningCheck: true });
|
||||||
|
|
||||||
logger.success(`SmartProxy started (HTTP: ${this.httpPort}, HTTPS: ${this.httpsPort}, Admin: ${this.adminUrl})`);
|
logger.success(`SmartProxy started (HTTP: ${this.httpPort}, HTTPS: ${this.httpsPort}, Admin: ${this.adminUrl})`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -360,12 +360,14 @@ export class SmartProxyManager {
|
|||||||
return routeConfigs;
|
return routeConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
async reloadConfig(): Promise<void> {
|
async reloadConfig(options: { skipRunningCheck?: boolean } = {}): Promise<void> {
|
||||||
|
if (!options.skipRunningCheck) {
|
||||||
const isRunning = await this.isRunning();
|
const isRunning = await this.isRunning();
|
||||||
if (!isRunning) {
|
if (!isRunning) {
|
||||||
logger.warn('SmartProxy not running, cannot reload config');
|
logger.warn('SmartProxy not running, cannot reload config');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const routes = this.buildRoutes();
|
const routes = this.buildRoutes();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user