feat(projects): add port env variables

This commit is contained in:
locdp 2024-08-24 20:26:54 +07:00
parent 3830ec7a69
commit 6f5ea74d7a
3 changed files with 13 additions and 3 deletions

8
.env
View File

@ -44,5 +44,11 @@ VITE_STATIC_SUPER_ROLE=R_SUPER
# sourcemap # sourcemap
VITE_SOURCE_MAP=N VITE_SOURCE_MAP=N
# Used to differentiate storage across different domains # used to differentiate storage across different domains
VITE_STORAGE_PREFIX=SOY_ VITE_STORAGE_PREFIX=SOY_
# the port number on which the server is running
VITE_SERVER_PORT=9527
# the port number used for previewing the application
VITE_PREVIEW_PORT=9725

View File

@ -103,6 +103,10 @@ declare namespace Env {
readonly VITE_ICONIFY_URL?: string; readonly VITE_ICONIFY_URL?: string;
/** Used to differentiate storage across different domains */ /** Used to differentiate storage across different domains */
readonly VITE_STORAGE_PREFIX?: string; readonly VITE_STORAGE_PREFIX?: string;
/** The port number on which the server is running */
readonly VITE_SERVER_PORT?: number;
/** The port number used for previewing the application */
readonly VITE_PREVIEW_PORT?: number;
} }
} }

View File

@ -32,7 +32,7 @@ export default defineConfig(configEnv => {
}, },
server: { server: {
host: '0.0.0.0', host: '0.0.0.0',
port: 9527, port: viteEnv.VITE_SERVER_PORT || 9527,
open: true, open: true,
proxy: createViteProxy(viteEnv, enableProxy), proxy: createViteProxy(viteEnv, enableProxy),
fs: { fs: {
@ -40,7 +40,7 @@ export default defineConfig(configEnv => {
} }
}, },
preview: { preview: {
port: 9725 port: viteEnv.VITE_PREVIEW_PORT || 9725
}, },
build: { build: {
reportCompressedSize: false, reportCompressedSize: false,