Skip to content

Commit

Permalink
feat: add constants for regions
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Nov 12, 2024
1 parent 2f744a8 commit 2c4af1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ export const PAGE_LIMIT = 12; // default page limit
export const CARD_LIMIT = 6; // default card limit
export const INTERVAL = 5 * 60000; // default interval to check for feedback

export const REGION_FRA = 'fra';
export const REGION_SYD = 'syd';
export const REGION_NYC = 'nyc';

export const SUBDOMAIN_FRA = 'fra.';
export const SUBDOMAIN_SYD = 'syd.';
export const SUBDOMAIN_NYC = 'nyc.';

export enum Dependencies {
FACTORS = 'dependency:factors',
IDENTITIES = 'dependency:identities',
Expand Down
9 changes: 1 addition & 8 deletions src/lib/stores/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { Billing } from '../sdk/billing';
import { Backups } from '../sdk/backups';
import { Sources } from '$lib/sdk/sources';
import { REGION_FRA, REGION_NYC, REGION_SYD, SUBDOMAIN_FRA, SUBDOMAIN_NYC, SUBDOMAIN_SYD } from '$lib/constants';

export function getApiEndpoint(region?: string): string {
if (VARS.APPWRITE_ENDPOINT) return VARS.APPWRITE_ENDPOINT;
Expand All @@ -33,14 +34,6 @@ export function getApiEndpoint(region?: string): string {
return `${protocol}://${subdomain}${hostname}/v1`;
}

const REGION_FRA = 'fra';
const REGION_SYD = 'syd';
const REGION_NYC = 'nyc';

const SUBDOMAIN_FRA = 'fra.';
const SUBDOMAIN_SYD = 'syd.';
const SUBDOMAIN_NYC = 'nyc.';

const getSubdomain = (region?: string) => {
switch (region) {
case REGION_FRA:
Expand Down

0 comments on commit 2c4af1f

Please sign in to comment.