Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/dev-playground/.env.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DATABRICKS_HOST=
DATABRICKS_APP_PORT=8001
DATABRICKS_WAREHOUSE_ID=
DATABRICKS_WORKSPACE_ID=
NODE_ENV='development'
Expand Down
10 changes: 8 additions & 2 deletions packages/appkit/src/plugins/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class ServerPlugin extends Plugin {
public static DEFAULT_CONFIG = {
autoStart: true,
host: process.env.FLASK_RUN_HOST || "0.0.0.0",
port: Number(process.env.DATABRICKS_APP_PORT) || 8000,
port:
Number(process.env.DATABRICKS_APP_PORT) ||
(process.env.NODE_ENV === "development" ? 0 : 8000),
};

/** Plugin manifest declaring metadata and resource requirements */
Expand Down Expand Up @@ -257,7 +259,11 @@ export class ServerPlugin extends Plugin {
private logStartupInfo() {
const isDev = process.env.NODE_ENV === "development";
const hasExplicitStaticPath = this.config.staticPath !== undefined;
const port = this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port;
const address = this.server?.address();
const port =
typeof address === "object" && address?.port
? address.port
: (this.config.port ?? ServerPlugin.DEFAULT_CONFIG.port);
const host = this.config.host ?? ServerPlugin.DEFAULT_CONFIG.host;

logger.info("Server running on http://%s:%d", host, port);
Expand Down
Loading