diff --git a/.env.example b/.env.example index bcdec01b7a..b71113f52a 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,18 @@ # The env the app is running in e.g. development, testflight, production EXPO_PUBLIC_ENV=development +# App view DID +EXPO_PUBLIC_APPVIEW_DID= + +# Chat service DID +EXPO_PUBLIC_CHAT_DID= + +# Bitdrift +BITDRIFT_API_KEY= + +# Sentry (deprecated) +SENTRY_AUTH_TOKEN= + # The log level for the app. EXPO_PUBLIC_LOG_LEVEL=debug # Currently unused. Enable debug for a subset of the debug logs. @@ -16,9 +28,3 @@ EXPO_PUBLIC_BUNDLE_IDENTIFIER= # each build. This should only be used for Statsig reporting and shouldn't be # used to identify a specific bundle. EXPO_PUBLIC_BUNDLE_DATE=0 - -# Bitdrift -BITDRIFT_API_KEY= - -# Sentry (deprecated) -SENTRY_AUTH_TOKEN= diff --git a/src/env.ts b/src/env.ts index c33106cffe..2ed5fdd6bf 100644 --- a/src/env.ts +++ b/src/env.ts @@ -1,10 +1,66 @@ import {Did} from '@atproto/api' -export const LOG_DEBUG = process.env.EXPO_PUBLIC_LOG_DEBUG || '' +/** + * Indicates whether the app is running in TestFlight mode + */ +export const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight' + +/** + * Indicates whether the app is __DEV__ or TestFlight + */ +export const IS_INTERNAL = __DEV__ || IS_TESTFLIGHT + +/** + * The DID of the appview service to proxy to. If undefined, use Bluesky's + * default app view. + */ +export const APPVIEW_DID: Did | undefined = process.env.EXPO_PUBLIC_APPVIEW_DID + +/** + * The DID of the chat service to proxy to. If undefined, chat should be + * disabled. + */ +export const CHAT_DID: Did | undefined = process.env.EXPO_PUBLIC_CHAT_DID + +/** + * Bitdrift API key. If undefined, Bitdrift should be disabled. + */ +export const BITDRIFT_API_KEY: string | undefined = + process.env.EXPO_PUBLIC_BITDRIFT_API_KEY + +/** + * Sentry API key. If undefined, Sentry should be disabled. + */ +export const SENTRY_API_KEY: string | undefined = + process.env.EXPO_PUBLIC_SENTRY_API_KEY + +/** + * The log level for the app. + */ export const LOG_LEVEL = (process.env.EXPO_PUBLIC_LOG_LEVEL || 'info') as | 'debug' | 'info' | 'warn' | 'error' -export const APPVIEW_DID: Did = process.env.APPVIEW_DID || '' +/** + * Currently unused. Enable debug for a subset of the debug logs. + */ +export const LOG_DEBUG: string = process.env.EXPO_PUBLIC_LOG_DEBUG || '' + +/** + * The commit hash that the current bundle was made from. The user can see the + * commit hash in the app's settings along with the other version info. Useful + * for debugging/reporting. + */ +export const BUNDLE_IDENTIFIER: string = + process.env.EXPO_PUBLIC_BUNDLE_IDENTIFIER ?? '' + +/** + * This will always be in the format of YYMMDD, so that it always increases for + * each build. This should only be used for Statsig reporting and shouldn't be + * used to identify a specific bundle. + */ +export const BUNDLE_DATE: number = IS_INTERNAL + ? 0 + : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)