mirror of
https://github.com/tale/headplane.git
synced 2026-08-13 07:06:51 +00:00
fix: allow hostname passthrough for hono node
This commit is contained in:
@@ -43,9 +43,10 @@ export interface EnvOverrides {
|
||||
path: string;
|
||||
}
|
||||
|
||||
export function configureConfig(
|
||||
overrides: Partial<EnvOverrides>,
|
||||
): EnvOverrides {
|
||||
export function configureConfig(overrides: {
|
||||
loadEnv: string | undefined;
|
||||
path: string | undefined;
|
||||
}): EnvOverrides {
|
||||
const loadResult = booleanEnv(overrides.loadEnv);
|
||||
if (loadResult instanceof type.errors) {
|
||||
log.error(
|
||||
|
||||
+13
-3
@@ -1,4 +1,5 @@
|
||||
import { env, versions } from 'node:process';
|
||||
import { constants, access } from 'node:fs/promises';
|
||||
import { env, exit, versions } from 'node:process';
|
||||
import type { UpgradeWebSocket } from 'hono/ws';
|
||||
import { createHonoServer } from 'react-router-hono-server/node';
|
||||
import type { WebSocket } from 'ws';
|
||||
@@ -19,6 +20,13 @@ declare global {
|
||||
// MARK: Side-Effects
|
||||
// This module contains a side-effect because everything running here
|
||||
// exists for the lifetime of the process, making it appropriate.
|
||||
try {
|
||||
await access('./node_modules/react-router', constants.F_OK | constants.R_OK);
|
||||
} catch {
|
||||
log.error('server', 'Cannot locate `node_modules`, please install them');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
log.info('server', 'Running Node.js %s', versions.node);
|
||||
configureLogger(env[envVariables.debugLog]);
|
||||
const config = await loadConfig(
|
||||
@@ -67,7 +75,9 @@ declare module 'react-router' {
|
||||
|
||||
export default await createHonoServer({
|
||||
useWebSocket: true,
|
||||
// overrideGlobalObjects: true,
|
||||
overrideGlobalObjects: true,
|
||||
port: config.server.port,
|
||||
hostname: config.server.host,
|
||||
|
||||
getLoadContext(c, { build, mode }) {
|
||||
// This is the place where we can handle reverse proxy translation
|
||||
@@ -89,6 +99,6 @@ export default await createHonoServer({
|
||||
}
|
||||
},
|
||||
listeningListener(info) {
|
||||
console.log(`Server is listening on http://localhost:${info.port}`);
|
||||
log.info('server', 'Running on %s:%s', info.address, info.port);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user