use BACKEND_PORT/FRONTEND_PORT as port fallbacks in backend and vite (#8454)
* feat: use WM_BACKEND_PORT/WM_FRONTEND_PORT env vars as port fallbacks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: use BACKEND_PORT/FRONTEND_PORT instead of WM_ prefixed vars Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: keep app.windmill.dev as ws proxy fallback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1035,7 +1035,10 @@ Windmill Community Edition {GIT_VERSION}
|
||||
}
|
||||
|
||||
if server_mode || worker_mode || indexer_mode || mcp_mode {
|
||||
let port_var = std::env::var("PORT").ok().and_then(|x| x.parse().ok());
|
||||
let port_var = std::env::var("PORT")
|
||||
.or_else(|_| std::env::var("BACKEND_PORT"))
|
||||
.ok()
|
||||
.and_then(|x| x.parse().ok());
|
||||
|
||||
let port = if server_mode || indexer_mode || mcp_mode {
|
||||
port_var.unwrap_or(DEFAULT_PORT as u16)
|
||||
|
||||
@@ -7,6 +7,12 @@ const file = fileURLToPath(new URL('package.json', import.meta.url))
|
||||
const json = readFileSync(file, 'utf8')
|
||||
const version = JSON.parse(json)
|
||||
|
||||
const remoteUrl =
|
||||
process.env.REMOTE ??
|
||||
(process.env.BACKEND_PORT
|
||||
? `http://localhost:${process.env.BACKEND_PORT}`
|
||||
: 'https://app.windmill.dev/')
|
||||
|
||||
let plugin = {
|
||||
name: 'configure-response-headers',
|
||||
configureServer: (server) => {
|
||||
@@ -31,16 +37,16 @@ const config = {
|
||||
'app.windmill.xyz',
|
||||
'public.windmill.xyz'
|
||||
],
|
||||
port: 3000,
|
||||
port: parseInt(process.env.FRONTEND_PORT) || 3000,
|
||||
cors: { origin: '*' },
|
||||
proxy: {
|
||||
'^/\\.well-known/.*': {
|
||||
target: process.env.REMOTE ?? 'https://app.windmill.dev',
|
||||
target: remoteUrl,
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
},
|
||||
'^/api/w/[^/]+/s3_proxy/.*': {
|
||||
target: process.env.REMOTE ?? 'https://app.windmill.dev/',
|
||||
target: remoteUrl,
|
||||
changeOrigin: false, // Important for signature to be correct
|
||||
cookieDomainRewrite: 'localhost',
|
||||
configure: (proxy, options) => {
|
||||
@@ -53,7 +59,7 @@ const config = {
|
||||
}
|
||||
},
|
||||
'^/api/.*': {
|
||||
target: process.env.REMOTE ?? 'https://app.windmill.dev/',
|
||||
target: remoteUrl,
|
||||
changeOrigin: true,
|
||||
cookieDomainRewrite: 'localhost'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user