fix: fix https config
This commit is contained in:
parent
c1388118a6
commit
8cca071d9b
@ -21,10 +21,19 @@ export const runtime = useContextKey('runtime', () => {
|
||||
type: 'client',
|
||||
};
|
||||
});
|
||||
|
||||
export const app = useContextKey('app', () => {
|
||||
const init = isInit;
|
||||
if (init) {
|
||||
// const config = assistantConfig.getConfig();
|
||||
const config = assistantConfig.getConfig();
|
||||
if (config?.https?.type !== 'https') {
|
||||
return new App({
|
||||
serverOptions: {
|
||||
path: '/client/router',
|
||||
httpType: 'http',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
return new App({
|
||||
serverOptions: {
|
||||
|
@ -32,7 +32,8 @@ export const runServer = async (port?: number, listenPath = '127.0.0.1') => {
|
||||
});
|
||||
} else {
|
||||
app.listen(_port, listenPath, () => {
|
||||
console.log(`Server is running on https://${listenPath}:${_port}`);
|
||||
const protocol = assistantConfig.getHttps().protocol;
|
||||
console.log(`Server is running on ${protocol}://${listenPath}:${_port}`);
|
||||
});
|
||||
}
|
||||
app.server.on(proxyRoute);
|
||||
|
@ -140,4 +140,11 @@ export class AssistantInit extends AssistantConfig {
|
||||
},
|
||||
} as AssistantConfigData;
|
||||
}
|
||||
getHttps() {
|
||||
const https = this.getConfig()?.https || {};
|
||||
return {
|
||||
https,
|
||||
protocol: https?.type === 'http' ? 'http' : 'https',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user