Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(projects): add port env variables #607

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,11 @@ VITE_STATIC_SUPER_ROLE=R_SUPER
# sourcemap
VITE_SOURCE_MAP=N

# Used to differentiate storage across different domains
# used to differentiate storage across different domains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个变更丢掉

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
4 changes: 4 additions & 0 deletions src/typings/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ declare namespace Env {
readonly VITE_ICONIFY_URL?: string;
/** Used to differentiate storage across different domains */
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;
}
}

Expand Down
4 changes: 2 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ export default defineConfig(configEnv => {
},
server: {
host: '0.0.0.0',
port: 9527,
port: viteEnv.VITE_SERVER_PORT || 9527,
open: true,
proxy: createViteProxy(viteEnv, enableProxy),
fs: {
cachedChecks: false
}
},
preview: {
port: 9725
port: viteEnv.VITE_PREVIEW_PORT || 9725
},
build: {
reportCompressedSize: false,
Expand Down