Skip to content

Commit

Permalink
Move port definition to env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Jun 21, 2024
1 parent 36e2d64 commit b2e58cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/utils/env.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type DbEngine = typeof supportedDbEngines[number];

const envVariables = z.object({
NODE_ENV: z.enum(['production', 'development', 'test']).optional(),
SHLINK_DASHBOARD_PORT: z.number().optional().default(3005),

// Database connection options
SHLINK_DASHBOARD_DB_DRIVER: z.enum(supportedDbEngines).optional(),
Expand Down
9 changes: 4 additions & 5 deletions server.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { createRequestHandler } from '@remix-run/express';
import express from 'express';
import { serverContainer } from './app/container/container.server';
import { env, isProd } from './app/utils/env.server';

const { NODE_ENV, SHLINK_DASHBOARD_PORT = '3005' } = process.env;

const viteDevServer = NODE_ENV === 'production'
const viteDevServer = isProd()
? null
: await import('vite').then(
(vite) =>
Expand All @@ -30,6 +29,6 @@ app.use(serverContainer.emForkMiddleware);
app.all('*', createRequestHandler({ build }));

app.listen(
Number(SHLINK_DASHBOARD_PORT),
() => console.log(`App listening on http://localhost:${SHLINK_DASHBOARD_PORT}`),
env.SHLINK_DASHBOARD_PORT,
() => console.log(`App listening on http://localhost:${env.SHLINK_DASHBOARD_PORT}`),
);

0 comments on commit b2e58cb

Please sign in to comment.