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

refactor: update environment variables for file URLs to use protocol,… #44

Merged
merged 1 commit into from
Dec 25, 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
11 changes: 7 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ NATS_URL=nats:4222

## frontend
INTERNAL_BACKEND_BASE_URL=https://backend.tarhche.com
NEXT_PUBLIC_FILES_BASE_URL=https://backend.tarhche.com
NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL=https://tarhche.com
NEXT_PUBLIC_FILES_PROTOCOL=https
NEXT_PUBLIC_FILES_HOST=backend.tarhche.com
NEXT_PUBLIC_FILES_PORT=80

## frontend local
# INTERNAL_BACKEND_BASE_URL=http://app
# NEXT_PUBLIC_FILES_BASE_URL=http://127.0.0.1:8000
# NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL=http://127.0.0.1:3000
# NEXT_PUBLIC_FILES_PROTOCOL=http
# NEXT_PUBLIC_FILES_HOST=127.0.0.1
# NEXT_PUBLIC_FILES_PORT=8000
5 changes: 3 additions & 2 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ services:
volumes:
- ./frontend:/opt/app
environment:
NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL: ${NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL}
INTERNAL_BACKEND_BASE_URL: ${INTERNAL_BACKEND_BASE_URL}
NEXT_PUBLIC_FILES_BASE_URL: ${NEXT_PUBLIC_FILES_BASE_URL}
NEXT_PUBLIC_FILES_PROTOCOL: ${NEXT_PUBLIC_FILES_PROTOCOL}
NEXT_PUBLIC_FILES_HOST: ${NEXT_PUBLIC_FILES_HOST}
NEXT_PUBLIC_FILES_PORT: ${NEXT_PUBLIC_FILES_PORT}
command: >
sh -c "npm install; npm run dev -- --hostname \"0.0.0.0\" --port 3000"

Expand Down
5 changes: 3 additions & 2 deletions frontend/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
INTERNAL_BACKEND_BASE_URL=https://backend.tarhche.com
NEXT_PUBLIC_FILES_BASE_URL=https://backend.tarhche.com
NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL=https://tarhche.com
NEXT_PUBLIC_FILES_PROTOCOL=https
NEXT_PUBLIC_FILES_HOST=backend.tarhche.com
NEXT_PUBLIC_FILES_PORT=80
5 changes: 3 additions & 2 deletions frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "backend.tarhche.com",
protocol: process.env.NEXT_PUBLIC_FILES_PROTOCOL,
hostname: process.env.NEXT_PUBLIC_FILES_HOST,
port: process.env.NEXT_PUBLIC_FILES_PORT,
},
],
},
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/constants/envs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export const INTERNAL_BACKEND_URL = process.env.INTERNAL_BACKEND_BASE_URL;
export const EXTERNAL_BACKEND_URL =
process.env.NEXT_PUBLIC_EXTERNAL_BACKEND_BASE_URL;
export const FILES_PUBLIC_URL = `https://backend.tarhche.com/files`;
export const FILES_PUBLIC_URL = `${process.env.NEXT_PUBLIC_FILES_PROTOCOL}://${process.env.NEXT_PUBLIC_FILES_HOST}:${process.env.NEXT_PUBLIC_FILES_PORT}/files`;
Loading