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(pluginsdk): Allow overriding proxy ports in deck dev-proxy #10115

Merged
merged 5 commits into from
Jun 26, 2024
Merged
Changes from 3 commits
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
11 changes: 7 additions & 4 deletions packages/pluginsdk/scripts/dev-proxy/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const packageJson = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));

const DEV_PROXY_HOST = process.env.DEV_PROXY_HOST || (packageJson.devProxy && packageJson.devProxy.host);

const DEV_PROXY_HTTP_PORT = parseInt(process.env.DEV_PROXY_HTTP_PORT || (packageJson.devProxy && packageJson.devProxy.httpPort)) || 9000;
const DEV_PROXY_HTTPS_PORT = parseInt(process.env.DEV_PROXY_HTTPS_PORT || (packageJson.devProxy && packageJson.devProxy.httpsPort)) || 9443;

if (!DEV_PROXY_HOST) {
console.error();
console.error();
Expand Down Expand Up @@ -94,7 +97,7 @@ app.use('/livereload.js', require('./livereload'));
app.use('/', createProxyMiddleware({ target: DEV_PROXY_HOST, changeOrigin: true }));

// http
http.createServer(app).listen(9000);
http.createServer(app).listen(DEV_PROXY_HTTP_PORT);

// https
https
Expand All @@ -105,7 +108,7 @@ https
},
app,
)
.listen(9443);
.listen(DEV_PROXY_HTTPS_PORT);

console.log(`Server started on http://localhost:9000/`);
console.log(`Server started on https://localhost:9443/`);
console.log(`Server started on http://localhost:${DEV_PROXY_HTTP_PORT}/`);
console.log(`Server started on https://localhost:${DEV_PROXY_HTTPS_PORT}/`);
Loading