Skip to content

Commit

Permalink
Use enviorment variables for port and host for preview server
Browse files Browse the repository at this point in the history
  • Loading branch information
holybaechu committed Feb 22, 2024
1 parent b21b565 commit f6b3628
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ node_modules
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
package-lock.json
bun.lockb
.env
Binary file modified bun.lockb
Binary file not shown.
11 changes: 9 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import dotenv from 'dotenv';

dotenv.config();

const port = parseInt(process.env.PORT || "3000");
const host = process.env.HOST || '0.0.0.0';

export default defineConfig({
plugins: [sveltekit()],
test: {
Expand All @@ -13,7 +16,11 @@ export default defineConfig({
watch: {
usePolling: true
},
port: parseInt(process.env.PORT || "3000"),
host: process.env.HOST || '0.0.0.0'
port: port,
host: host
},
preview: {
port: port,
host: host
}
});

0 comments on commit f6b3628

Please sign in to comment.