Skip to content

Commit

Permalink
feat: override backend url through env variables after build
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Sep 16, 2023
1 parent 3435a55 commit cb868da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ services:
image: aepp-base
build:
context: .
args:
VUE_APP_BACKEND_URL: http://localhost:3079
ports: ["3080:80"]
environment:
- VUE_APP_BACKEND_URL=http://localhost:3079
backend:
image: aepp-base-backend
build: backend
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
explorerUrl: '$VUE_APP_EXPLORER_URL',
compilerUrl: '$VUE_APP_COMPILER_URL',
};
window.overrideBackendUrl = '$VUE_APP_BACKEND_URL';
</script>

<link rel="preconnect" href="https://fonts.googleapis.com">
Expand Down
4 changes: 3 additions & 1 deletion src/store/plugins/remoteConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export default (store) => {
if (ENV_MOBILE_DEVICE) {
auth.pushApiSubscription = await getPushApiSubscription();
}
const socket = (await io())(process.env.VUE_APP_BACKEND_URL, { auth });
const backendUrl = ['', '$VUE_APP_BACKEND_URL'].includes(window.overrideBackendUrl)
? process.env.VUE_APP_BACKEND_URL : window.overrideBackendUrl;
const socket = (await io())(backendUrl, { auth });
const closeCbs = [socket.close.bind(socket)];

let processedState = cloneDeep(getStateForSync(store.state));
Expand Down

0 comments on commit cb868da

Please sign in to comment.