-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chrome-extension): Add env constants
- Loading branch information
Showing
4 changed files
with
43 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,37 @@ | ||
// export const AUTH_HEADER = 'Authorization'; | ||
// export const AUTH_HEADER_DEV = '__clerk_db_jwt'; | ||
|
||
export const AUTH_HEADER = { | ||
PRODUCTION: 'Authorization', | ||
DEVELOPMENT: '__clerk_db_jwt', | ||
}; | ||
|
||
export const CLIENT_JWT_KEY = '__client'; | ||
export const STORAGE_KEY_CLIENT_JWT = '__clerk_client_jwt'; | ||
export const DEFAULT_LOCAL_HOST_PERMISSION = 'http://localhost'; | ||
export const AUTH_HEADER = 'Authorization'; | ||
export const AUTH_HEADER_DEV = '__clerk_db_jwt'; | ||
export const SESSION_ID_HEADER_DEV = '_clerk_session_id'; | ||
export const STORAGE_KEY_CLIENT_JWT = '__clerk_client_jwt'; | ||
|
||
// Environment Variables | ||
|
||
function getViteEnvVariable(name: string): string | undefined { | ||
const viteEnvName = `VITE_${name}`; | ||
|
||
// @ts-expect-error - Vite specific | ||
if (typeof import.meta !== 'undefined' && import.meta.env && typeof import.meta.env[viteEnvName] === 'string') { | ||
// @ts-expect-error - Vite specific | ||
return import.meta.env[viteEnvName]; | ||
} | ||
|
||
return undefined; | ||
} | ||
|
||
export const PUBLISHABLE_KEY = | ||
process.env.PLASMO_PUBLIC_CLERK_PUBLISHABLE_KEY || | ||
getViteEnvVariable('CLERK_PUBLISHABLE_KEY') || | ||
process.env.CLERK_PUBLISHABLE_KEY || | ||
''; | ||
|
||
export const SYNC_HOST = | ||
process.env.PLASMO_PUBLIC_CLERK_SYNC_HOST || | ||
getViteEnvVariable('CLERK_SYNC_HOST') || | ||
process.env.CLERK_SYNC_HOST || | ||
undefined; |
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