-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move hosts, keys and ids 'constants.ts'
- Loading branch information
Showing
5 changed files
with
23 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const RECAPTCHA_SITE_KEY = '6LeuSEYeAAAAAJrZY05dnjlIkU-3EAe4JqDdd3wz'; | ||
export const GOOGLE_TAG_ID = 'G-C9SQS63TJQ'; | ||
export const PRODUCTION_HOST = 'https://meaningfulcode.org'; | ||
export const LOCAL_DEV_HOST = 'http://localhost:3000'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import { PRODUCTION_HOST, LOCAL_DEV_HOST } from '@/constants/constants'; | ||
|
||
export default function getHost() { | ||
if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'test') { | ||
throw new Error('getHost() should only be called on the server side'); | ||
} | ||
|
||
const productionHost = 'https://meaningfulcode.org'; | ||
if (process.env.NEXT_PUBLIC_VERCEL_ENV) { | ||
if (process.env.NEXT_PUBLIC_VERCEL_ENV === 'production') { | ||
return productionHost; | ||
return PRODUCTION_HOST; | ||
} else { | ||
return `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`; | ||
} | ||
} else if (process.env.MEANINGFUL_DEV) { | ||
return 'http://localhost:3000'; | ||
return LOCAL_DEV_HOST; | ||
} else { | ||
return productionHost; | ||
return PRODUCTION_HOST; | ||
} | ||
} |