Skip to content

Commit

Permalink
fix: add meilisearch prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
sargon64 committed Aug 15, 2023
1 parent ebca261 commit 01c5a57
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/web/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# apps/web
BEATFORGE_API_URL=
BEATFORGE_GITHUB_CALLBACK_URL=
BEATFORGE_GITHUB_CALLBACK_URL=
MEILI_PREFIX=
2 changes: 1 addition & 1 deletion apps/web/src/routes/discover/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
const search = async (q: String) => {
const res = await (
await fetch(`https://search.beatforge.net/indexes/staging_mods/search`, {
await fetch(`https://search.beatforge.net/indexes/${import.meta.env.MEILI_PREFIX}_mods/search`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down
7 changes: 5 additions & 2 deletions apps/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default defineConfig(({ mode }) => {
const env = {
API_URL: process.env.BEATFORGE_API_URL ?? file_env.BEATFORGE_API_URL,
GITHUB_CALLBACK_URL:
process.env.BEATFORGE_GITHUB_CALLBACK_URL ?? file_env.BEATFORGE_GITHUB_CALLBACK_URL
process.env.BEATFORGE_GITHUB_CALLBACK_URL ?? file_env.BEATFORGE_GITHUB_CALLBACK_URL,
MEILI_PREFIX:
process.env.MEILI_PREFIX ?? file_env.MEILI_PREFIX ?? 'staging'
};

// if (!env.API_URL) throw new Error('BEATFORGE_API_URL is not defined');
Expand All @@ -24,7 +26,8 @@ export default defineConfig(({ mode }) => {
],
define: {
'import.meta.env.API_URL': JSON.stringify(env.API_URL),
'import.meta.env.GITHUB_CALLBACK_URL': JSON.stringify(env.GITHUB_CALLBACK_URL)
'import.meta.env.GITHUB_CALLBACK_URL': JSON.stringify(env.GITHUB_CALLBACK_URL),
'import.meta.env.MEILI_PREFIX': JSON.stringify(env.MEILI_PREFIX)
}
};
});

0 comments on commit 01c5a57

Please sign in to comment.