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

Config/env vars #68

Merged
merged 4 commits into from
Mar 18, 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
2 changes: 1 addition & 1 deletion __mocks__/handlers/endorsements.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BASE_URL } from "@/constants/urls";
import endorsementDetails from "../db/endorsementDetails.json";

export const endorsementsHandler = [
rest.get(`${BASE_URL.dev}/endorsements`, (req, res, ctx) => {
rest.get(`${BASE_URL}/endorsements`, (req, res, ctx) => {
return res(ctx.status(200), ctx.json(endorsementDetails));
}),
];
8 changes: 0 additions & 8 deletions env/.env.development

This file was deleted.

10 changes: 0 additions & 10 deletions env/.env.production

This file was deleted.

8 changes: 0 additions & 8 deletions env/.env.staging

This file was deleted.

8 changes: 0 additions & 8 deletions env/.env.test

This file was deleted.

1 change: 1 addition & 0 deletions process-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ declare namespace NodeJS {
NEXT_PUBLIC_WELCOME_SITE: string;
NEXT_PUBLIC_WWW_SITE: string;
NEXT_PUBLIC_MY_SITE: string;
NEXT_PUBLIC_APP_ENV: "staging" | "production" | "test" | "development";
}
}
12 changes: 6 additions & 6 deletions src/components/common/Navbar/navbar.constants.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { RDS_BACKEND_URL } from "@/constants/urls";
import { RDS_BACKEND_URL, URLS } from "@/constants/urls";
import { NavbarLink } from "./navbar.types";

// ?v2=true so that we get rds-session-v2 cookie from RDS backend
export const SIGNIN_URL = `${RDS_BACKEND_URL}/auth/github/login?redirectURL=${process.env.NEXT_PUBLIC_SKILL_TREE_SITE}?v2=true`;
export const SIGNIN_URL = `${RDS_BACKEND_URL}/auth/github/login?redirectURL=${URLS.SKILL_TREE_SITE}?v2=true`;

export const NAVBAR_LINKS: NavbarLink[] = [
{
id: "welcome-site",
name: "Welcome",
link: process.env.NEXT_PUBLIC_WELCOME_SITE,
link: URLS.WELCOME_SITE,
},
{
id: "events-site",
name: "Events",
link: `${process.env.NEXT_PUBLIC_WWW_SITE}/events`,
link: `${URLS.WWW_SITE}/events`,
},
{
id: "members-site",
name: "Members",
link: process.env.NEXT_PUBLIC_MEMBERS_SITE,
link: URLS.MEMBERS_SITE,
},
{
id: "status-site",
name: "Status",
link: process.env.NEXT_PUBLIC_STATUS_SITE,
link: URLS.STATUS_SITE,
},
];
52 changes: 50 additions & 2 deletions src/constants/urls.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
export const BASE_URL = process.env.NEXT_PUBLIC_BACKEND_BASE_URL;
export const RDS_BACKEND_URL = process.env.NEXT_PUBLIC_RDS_BACKEND_URL;
type Urls = {
[key: string]: {
BACKEND_BASE_URL: string;
RDS_BACKEND_URL: string;
SKILL_TREE_SITE: string;
STATUS_SITE: string;
MEMBERS_SITE: string;
WELCOME_SITE: string;
WWW_SITE: string;
MY_SITE: string;
};
};

export const URLS_MAP: Urls = {
production: {
BACKEND_BASE_URL: "https://skilltree-api.realdevsquad.com/v1",
RDS_BACKEND_URL: "https://api.realdevsquad.com",
SKILL_TREE_SITE: "https:/skilltree.realdevsquad.com",
STATUS_SITE: "https://status.realdevsquad.com",
MEMBERS_SITE: "https://members.realdevsquad.com",
WELCOME_SITE: "https://welcome.realdevsquad.com",
WWW_SITE: "https://www.realdevsquad.com",
MY_SITE: "https://my.realdevsquad.com",
},
staging: {
BACKEND_BASE_URL: "https://staging-skilltree-api.realdevsquad.com/v1",
RDS_BACKEND_URL: "https://staging-api.realdevsquad.com",
SKILL_TREE_SITE: "https://staging-skilltree.realdevsquad.com",
STATUS_SITE: "https://staging-status.realdevsquad.com",
MEMBERS_SITE: "https://staging-members.realdevsquad.com",
WELCOME_SITE: "https://welcome.realdevsquad.com",
WWW_SITE: "https://staging-www.realdevsquad.com",
MY_SITE: "https://staging-my.realdevsquad.com",
},
development: {
BACKEND_BASE_URL: "https://staging-skilltree-api.realdevsquad.com/v1",
RDS_BACKEND_URL: "https://staging-api.realdevsquad.com",
SKILL_TREE_SITE: "https://staging-skilltree.realdevsquad.com",
STATUS_SITE: "https://staging-status.realdevsquad.com",
MEMBERS_SITE: "https://staging-members.realdevsquad.com",
WELCOME_SITE: "https://welcome.realdevsquad.com",
WWW_SITE: "https://staging-www.realdevsquad.com",
MY_SITE: "https://staging-my.realdevsquad.com",
},
};

export const URLS = { ...URLS_MAP[process.env.NEXT_PUBLIC_APP_ENV] };

export const BASE_URL: string = URLS.BACKEND_BASE_URL;
export const RDS_BACKEND_URL: string = URLS.RDS_BACKEND_URL;
Loading