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

fix(frontend): mark env variables as client side #147

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NEXT_PUBLIC_FLOW_ENV=
NEXT_PUBLIC_EMULATOR_API=

NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
NEXT_PUBLIC_WEBSOCKET_URL=ws://localhost:8000
3 changes: 2 additions & 1 deletion frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

const removeImports = require("next-remove-imports")(); // get rid of this whenever possible

const backendUrl = process.env.BACKEND_URL || "http://localhost:8000";
const backendUrl =
process.env.NEXT_PUBLIC_BACKEND_URL || "http://localhost:8000";

const nextConfig = {
experimental: {
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/.env.example

This file was deleted.

9 changes: 5 additions & 4 deletions frontend/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// ENV variables
export const BACKEND_URL = process.env.BACKEND_URL || "localhost:8000";
// export const WEBSOCKET_URL = process.env.WEBSOCKET_URL || "ws://localhost:8000"
export const WEBSOCKET_URL = process.env.WEBSOCKET_URL || "ws://" + BACKEND_URL;
// Public ENV variables
export const BACKEND_URL =
process.env.NEXT_PUBLIC_BACKEND_URL || "localhost:8000";
export const WEBSOCKET_URL =
process.env.NEXT_PUBLIC_WEBSOCKET_URL || "ws://localhost:8000";

// UI behaviour
export const DEFAULT_ACTIVE_DASHBOARD_TAB = "overview";
Loading