Skip to content

Commit

Permalink
Load the local hostname's config, where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
nexy7574 committed Nov 30, 2024
1 parent a142630 commit 5ea2d15
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/components/ClientConfigLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { ClientConfig } from '../hooks/useClientConfig';
import { trimTrailingSlash } from '../utils/common';

const getClientConfig = async (): Promise<ClientConfig> => {
const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`;
const config = await fetch(url, { method: 'GET' });
let url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.${window.location.hostname}.json`;
let config = await fetch(url, { method: 'GET' });
if(config.status===404) {
url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`;
config = await fetch(url, { method: 'GET' });
}
return config.json();
};

Expand Down

0 comments on commit 5ea2d15

Please sign in to comment.