Skip to content

Commit d3f8075

Browse files
committed
Update env variables
1 parent bd4e53f commit d3f8075

File tree

8 files changed

+13
-135
lines changed

8 files changed

+13
-135
lines changed

.frontmatter/database/mediaDb.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

components/Page/Sponsors.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const Sponsors: React.FunctionComponent<ISponsorsProps> = (props: React.P
1414

1515
useEffect(() => {
1616
const getSponsors = async () => {
17-
const response = await fetch(`${CONFIG.apiUrl}/api/sponsors`);
17+
const response = await fetch(`${CONFIG.urls.api}/api/sponsors`);
1818

1919
if (!response.ok) {
2020
setIndividuals(null);

constants/config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
export const CONFIG = {
2-
apiUrl: "https://fontmatter-fncs.azurewebsites.net",
3-
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
4-
openAi: {
5-
token: process.env.OPENAI_TOKEN,
2+
urls: {
3+
api: process.env.NEXT_PUBLIC_API_URL,
4+
production: "https://frontmatter.codes",
5+
preview: process.env.CF_PAGES_URL,
6+
local: "http://localhost:3000",
67
},
8+
environment: process.env.NEXT_PUBLIC_VERCEL_ENV,
79
github: {
810
token: process.env.GITHUB_AUTH,
911
},

lib/publicUrl.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { CONFIG } from "../constants";
22

33
export function publicUrl() {
44
if (CONFIG.environment === "production") {
5-
return `https://frontmatter.codes`;
5+
return CONFIG.urls.production;
66
} else if (CONFIG.environment === "preview") {
7-
return `https://beta.frontmatter.codes`;
7+
return CONFIG.urls.preview;
88
} else {
9-
return `http://localhost:3000`;
9+
return CONFIG.urls.local;
1010
}
1111
}

pages/analytics/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Charts = () => {
1616
const [stats, setStats] = useState<Analytics | null>(null);
1717

1818
const getStats = async () => {
19-
const res = await fetch(`${CONFIG.apiUrl}/api/stats`);
19+
const res = await fetch(`${CONFIG.urls.api}/api/stats`);
2020
const json = await res.json();
2121
setStats(json);
2222
};

services/GithubService.ts

Lines changed: 0 additions & 94 deletions
This file was deleted.

services/OpenAiService.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

services/StarService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class StarService {
1010
}
1111

1212
if (!StarService.starCaller) {
13-
StarService.starCaller = fetch(`${CONFIG.apiUrl}/api/stars`);
13+
StarService.starCaller = fetch(`${CONFIG.urls.api}/api/stars`);
1414
}
1515

1616
const response = await StarService.starCaller;

0 commit comments

Comments
 (0)