Skip to content
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 .changeset/six-pumas-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@everipedia/iq-utils": patch
---

Update GraphQL API baseURL to api.iq.wiki
2 changes: 1 addition & 1 deletion src/lib/wiki-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const cache = new QuickLRU({
});

export const api = axios.create({
baseURL: "https://graph.everipedia.org/graphql",
baseURL: "https://api.iq.wiki/graphql",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The new baseURL is hardcoded. While this works, it's generally better practice to configure such URLs through environment variables. This approach offers several benefits:

  • Flexibility: Easily switch between different API endpoints for development, staging, and production environments without code changes.
  • Maintainability: Centralizes configuration, making it easier to update URLs without searching through the codebase.
  • Security: Avoids committing potentially sensitive or environment-specific URLs directly into the repository (though this specific URL is public).

Have you considered using an environment variable for this baseURL? You could provide a fallback to the current URL if the environment variable isn't set.

Suggested change
baseURL: "https://api.iq.wiki/graphql",
baseURL: process.env.NEXT_PUBLIC_GRAPHQL_API_BASEURL || "https://api.iq.wiki/graphql",

headers: {
"Content-Type": "application/json",
},
Expand Down