Skip to content

Commit

Permalink
Update controllerHost in api.ts to use current host in browser enviro…
Browse files Browse the repository at this point in the history
…nment
  • Loading branch information
elikoga committed Apr 22, 2024
1 parent 49c16f8 commit 5634815
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { browser } from '$app/environment';
import { env } from '$env/dynamic/public';

export const controllerHost = env.PUBLIC_CONTROLLER_HOST || '127.0.0.1:8000';
export let controllerHost = env.PUBLIC_CONTROLLER_HOST || '127.0.0.1:8000';
if (browser) {
// set controllerHost to the current host:8000
controllerHost = window.location.hostname + ':8000';
}
console.log('controllerHost:', controllerHost);
export const controllerProtocol = env.PUBLIC_CONTROLLER_PROTOCOL || 'http';

if (!env.PUBLIC_CONTROLLER_HOST) {
Expand Down

0 comments on commit 5634815

Please sign in to comment.