From f983d787b42b9dcfe0b7185065eb45242699d0fe Mon Sep 17 00:00:00 2001 From: sriram veeraghanta Date: Thu, 14 Sep 2023 12:26:07 +0530 Subject: [PATCH] env and docker fixes (#2182) --- nginx/nginx.conf.template | 43 +++++++++++++-------------- space/.env.example | 4 +-- space/components/accounts/sign-in.tsx | 4 +-- space/helpers/common.helper.ts | 3 +- space/pages/onboarding/index.tsx | 2 +- web/helpers/common.helper.ts | 7 ++--- 6 files changed, 29 insertions(+), 34 deletions(-) diff --git a/nginx/nginx.conf.template b/nginx/nginx.conf.template index 974f4907d..36a68fa55 100644 --- a/nginx/nginx.conf.template +++ b/nginx/nginx.conf.template @@ -1,30 +1,29 @@ events { } - http { - sendfile on; + sendfile on; -server { - listen 80; - root /www/data/; - access_log /var/log/nginx/access.log; + server { + listen 80; + root /www/data/; + access_log /var/log/nginx/access.log; - client_max_body_size ${FILE_SIZE_LIMIT}; + client_max_body_size ${FILE_SIZE_LIMIT}; - location / { - proxy_pass http://planefrontend:3000/; + location / { + proxy_pass http://planefrontend:3000/; + } + + location /api/ { + proxy_pass http://planebackend:8000/api/; + } + + location /spaces/ { + proxy_pass http://planedeploy:3000/spaces/; + } + + location /${BUCKET_NAME}/ { + proxy_pass http://plane-minio:9000/uploads/; + } } - - location /api/ { - proxy_pass http://planebackend:8000/api/; - } - - location /spaces/ { - proxy_pass http://planedeploy:3000/spaces/; - } - - location /${BUCKET_NAME}/ { - proxy_pass http://plane-minio:9000/uploads/; - } -} } \ No newline at end of file diff --git a/space/.env.example b/space/.env.example index c7063c155..56e9f1e95 100644 --- a/space/.env.example +++ b/space/.env.example @@ -1,6 +1,4 @@ -# Public boards deploy URL -NEXT_PUBLIC_DEPLOY_URL="" # Google Client ID for Google OAuth NEXT_PUBLIC_GOOGLE_CLIENTID="" # Flag to toggle OAuth -NEXT_PUBLIC_ENABLE_OAUTH=1 \ No newline at end of file +NEXT_PUBLIC_ENABLE_OAUTH=0 \ No newline at end of file diff --git a/space/components/accounts/sign-in.tsx b/space/components/accounts/sign-in.tsx index d2f1a1206..d3c29103d 100644 --- a/space/components/accounts/sign-in.tsx +++ b/space/components/accounts/sign-in.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useEffect } from "react"; import Image from "next/image"; import { useRouter } from "next/router"; @@ -13,7 +13,7 @@ import useToast from "hooks/use-toast"; // components import { EmailPasswordForm, GithubLoginButton, GoogleLoginButton, EmailCodeForm } from "components/accounts"; // images -const imagePrefix = process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX ? "/spaces" : ""; +const imagePrefix = Boolean(parseInt(process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX || "0")) ? "/spaces" : ""; export const SignInView = observer(() => { const { user: userStore } = useMobxStore(); diff --git a/space/helpers/common.helper.ts b/space/helpers/common.helper.ts index d96c342b5..758d7c370 100644 --- a/space/helpers/common.helper.ts +++ b/space/helpers/common.helper.ts @@ -1,2 +1 @@ -export const API_BASE_URL = - process.env.NEXT_PUBLIC_API_BASE_URL !== undefined ? process.env.NEXT_PUBLIC_API_BASE_URL : "http://localhost:8000"; +export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL ? process.env.NEXT_PUBLIC_API_BASE_URL : ""; diff --git a/space/pages/onboarding/index.tsx b/space/pages/onboarding/index.tsx index 491146410..12b09641b 100644 --- a/space/pages/onboarding/index.tsx +++ b/space/pages/onboarding/index.tsx @@ -5,7 +5,7 @@ import { useMobxStore } from "lib/mobx/store-provider"; // components import { OnBoardingForm } from "components/accounts/onboarding-form"; -const imagePrefix = process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX ? "/spaces" : ""; +const imagePrefix = Boolean(parseInt(process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX || "0")) ? "/spaces" : ""; const OnBoardingPage = () => { const { user: userStore } = useMobxStore(); diff --git a/web/helpers/common.helper.ts b/web/helpers/common.helper.ts index 0829863c9..7fb8896de 100644 --- a/web/helpers/common.helper.ts +++ b/web/helpers/common.helper.ts @@ -17,7 +17,6 @@ export const debounce = (func: any, wait: number, immediate: boolean = false) => }; }; -export const API_BASE_URL = - process.env.NEXT_PUBLIC_API_BASE_URL !== undefined - ? process.env.NEXT_PUBLIC_API_BASE_URL - : "http://localhost:8000"; +export const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL + ? process.env.NEXT_PUBLIC_API_BASE_URL + : "";