Skip to content

Commit

Permalink
chore(ui): webpack dev server proxy to take context path from env var…
Browse files Browse the repository at this point in the history
…iable
  • Loading branch information
glasstiger committed Jan 8, 2025
1 parent b290379 commit 79d9d2d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/web-console/src/store/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Storage extends Dexie {
// add initial buffer on db creation
// this is only called once, when DB is not available yet
this.on("populate", () => {
// populate intial buffer with value from localStorage, then clear it.
// populate initial buffer with value from localStorage, then clear it.
// this is to migrate from localStorage to indexedDB
const valueFromDeprecatedStorage = getValue(StoreKey.QUERY_TEXT)
if (typeof valueFromDeprecatedStorage !== "undefined") {
Expand Down
21 changes: 17 additions & 4 deletions packages/web-console/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const config = {
port: 9999,
backendUrl: "http://127.0.0.1:9000",
isProduction: process.env.NODE_ENV === "production",
contextPath: process.env.CONTEXT_PATH || "",
}

module.exports = {
Expand Down Expand Up @@ -80,10 +81,22 @@ module.exports = {
host: "localhost",
hot: true,
port: config.port,
proxy: {
context: ["/imp", "/exp", "/exec", "/chk", "/settings", "/warnings"],
target: config.backendUrl,
},
proxy: [
{
context: [
config.contextPath + "/imp", config.contextPath + "/exp", config.contextPath + "/exec",
config.contextPath + "/chk", config.contextPath + "/settings", config.contextPath + "/warnings"
],
target: config.backendUrl,
},
{
context: [ config.contextPath ],
target: 'http://localhost:' + config.port,
pathRewrite: path => {
return path.startsWith(config.contextPath) ? path.substr(config.contextPath.length) : path;
},
},
],
client: {
overlay: false,
},
Expand Down

0 comments on commit 79d9d2d

Please sign in to comment.