forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1import {type Did} from '@atproto/api'
2
3import packageJson from '#/../package.json'
4
5/**
6 * The semver version of the app, as defined in `package.json.`
7 *
8 * N.B. The fallback is needed for Render.com deployments
9 */
10export const RELEASE_VERSION: string =
11 process.env.EXPO_PUBLIC_RELEASE_VERSION || packageJson.version
12
13/**
14 * The env the app is running in e.g. development, testflight, production, e2e
15 */
16export const ENV: string = process.env.EXPO_PUBLIC_ENV as
17 | 'production'
18 | 'testflight'
19 | 'development'
20 | 'e2e'
21 | (string & {})
22
23/**
24 * Indicates whether the app is running in TestFlight
25 */
26export const IS_TESTFLIGHT = ENV === 'testflight'
27
28/**
29 * Indicates whether the app is `__DEV__`
30 */
31export const IS_DEV = __DEV__
32
33/**
34 * Indicates whether the app is running in a test environment
35 */
36export const IS_E2E = ENV === 'e2e'
37
38/**
39 * Indicates whether the app is `__DEV__` or TestFlight
40 */
41export const IS_INTERNAL = IS_DEV || IS_TESTFLIGHT
42
43/**
44 * The commit hash that the current bundle was made from. The user can
45 * see the commit hash in the app's settings along with the other version info.
46 * Useful for debugging/reporting.
47 */
48export const BUNDLE_IDENTIFIER: string =
49 process.env.EXPO_PUBLIC_BUNDLE_IDENTIFIER || 'dev'
50
51/**
52 * This will always be in the format of YYMMDDHH, so that it always increases
53 * for each build. This should only be used for StatSig reporting and shouldn't
54 * be used to identify a specific bundle.
55 */
56export const BUNDLE_DATE: number =
57 process.env.EXPO_PUBLIC_BUNDLE_DATE === undefined
58 ? 0
59 : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)
60
61/**
62 * The log level for the app.
63 */
64export const LOG_LEVEL = (process.env.EXPO_PUBLIC_LOG_LEVEL || 'info') as
65 | 'debug'
66 | 'info'
67 | 'warn'
68 | 'error'
69
70/**
71 * Enable debug logs for specific logger instances
72 */
73export const LOG_DEBUG: string = process.env.EXPO_PUBLIC_LOG_DEBUG || ''
74
75/**
76 * The DID of the Bluesky appview to proxy to
77 */
78export const BLUESKY_PROXY_DID: Did =
79 process.env.EXPO_PUBLIC_BLUESKY_PROXY_DID || 'did:web:api.bsky.app'
80
81/**
82 * The DID of the chat service to proxy to
83 */
84export const CHAT_PROXY_DID: Did =
85 process.env.EXPO_PUBLIC_CHAT_PROXY_DID || 'did:web:api.bsky.chat'
86
87/**
88 * Sentry DSN for telemetry
89 */
90export const SENTRY_DSN: string | undefined = process.env.EXPO_PUBLIC_SENTRY_DSN
91
92/**
93 * Bitdrift API key. If undefined, Bitdrift should be disabled.
94 */
95export const BITDRIFT_API_KEY: string | undefined =
96 process.env.EXPO_PUBLIC_BITDRIFT_API_KEY
97
98/**
99 * GCP project ID which is required for native device attestation. On web, this
100 * should be unset and evaluate to 0.
101 */
102export const GCP_PROJECT_ID: number =
103 process.env.EXPO_PUBLIC_GCP_PROJECT_ID === undefined
104 ? 0
105 : Number(process.env.EXPO_PUBLIC_GCP_PROJECT_ID)
106
107/**
108 * URLs for the app config web worker. Can be a
109 * locally running server, see `env.example` for more.
110 */
111export const BAPP_CONFIG_DEV_URL = process.env.BAPP_CONFIG_DEV_URL
112
113/**
114 * Dev environment passthrough value for bapp-config web worker. Allows local
115 * dev access to the web worker running in `development` mode.
116 */
117export const BAPP_CONFIG_DEV_BYPASS_SECRET: string =
118 process.env.BAPP_CONFIG_DEV_BYPASS_SECRET
119
120export const BAPP_CONFIG_PROD_URL = `https://ip.bsky.app`
121export const BAPP_CONFIG_URL = IS_DEV
122 ? (BAPP_CONFIG_DEV_URL ?? BAPP_CONFIG_PROD_URL)
123 : BAPP_CONFIG_PROD_URL
124
125export const ENV_PUBLIC_BSKY_SERVICE: string | undefined =
126 process.env.EXPO_PUBLIC_PUBLIC_BSKY_SERVICE
127export const ENV_APPVIEW_DID_PROXY: `did:${string}#bsky_appview` | undefined =
128 process.env.EXPO_PUBLIC_APPVIEW_DID_PROXY