about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-11-11 15:02:19 -0600
committerPaul Frazee <pfrazee@gmail.com>2022-11-11 15:02:19 -0600
commit210082be93cd369b868e748c7e89e95fc3ce6bbe (patch)
treea6371c2f006a0fa19068fe283da3ed3d3df57fb0 /src
parent38ed9a794353ae89c5c311dcecab00f0313ec675 (diff)
downloadvoidsky-210082be93cd369b868e748c7e89e95fc3ce6bbe.tar.zst
Add staging env
Diffstat (limited to 'src')
-rw-r--r--src/env.native.ts13
-rw-r--r--src/env.ts11
-rw-r--r--src/state/index.ts10
-rw-r--r--src/view/screens/Home.tsx6
-rw-r--r--src/view/screens/Login.tsx5
5 files changed, 34 insertions, 11 deletions
diff --git a/src/env.native.ts b/src/env.native.ts
index 581b211ca..a2ec3a4dc 100644
--- a/src/env.native.ts
+++ b/src/env.native.ts
@@ -1,8 +1,13 @@
 // @ts-ignore types not available -prf
-import {REACT_APP_AUTH_LOBBY} from '@env'
+import {REACT_APP_BUILD} from '@env'
 
-if (typeof REACT_APP_AUTH_LOBBY !== 'string') {
-  throw new Error('ENV: No auth lobby provided')
+if (typeof REACT_APP_BUILD !== 'string') {
+  throw new Error('ENV: No env provided')
+}
+if (!['dev', 'staging', 'prod'].includes(REACT_APP_BUILD)) {
+  throw new Error(
+    `ENV: Env must be "dev", "staging", or "prod," got "${REACT_APP_BUILD}"`,
+  )
 }
 
-export const AUTH_LOBBY = REACT_APP_AUTH_LOBBY
+export const BUILD = REACT_APP_BUILD
diff --git a/src/env.ts b/src/env.ts
index 78fb88acc..a379e435f 100644
--- a/src/env.ts
+++ b/src/env.ts
@@ -1,5 +1,10 @@
-if (typeof process.env.REACT_APP_AUTH_LOBBY !== 'string') {
-  throw new Error('ENV: No auth lobby provided')
+if (typeof process.env.REACT_APP_BUILD !== 'string') {
+  throw new Error('ENV: No env provided')
+}
+if (!['dev', 'staging', 'prod'].includes(process.env.REACT_APP_BUILD)) {
+  throw new Error(
+    `ENV: Env must be "dev", "staging", or "prod," got "${process.env.REACT_APP_BUILD}"`,
+  )
 }
 
-export const AUTH_LOBBY = process.env.REACT_APP_AUTH_LOBBY
+export const BUILD = process.env.REACT_APP_BUILD
diff --git a/src/state/index.ts b/src/state/index.ts
index 2c3df7d07..a886e7611 100644
--- a/src/state/index.ts
+++ b/src/state/index.ts
@@ -3,8 +3,14 @@ import {sessionClient as AtpApi} from '../third-party/api'
 import {RootStoreModel} from './models/root-store'
 import * as libapi from './lib/api'
 import * as storage from './lib/storage'
-
-export const DEFAULT_SERVICE = 'http://localhost:2583'
+import {BUILD} from '../env'
+
+export const DEFAULT_SERVICE =
+  BUILD === 'prod'
+    ? 'http://localhost:2583' // TODO
+    : BUILD === 'staging'
+    ? 'https://pds.staging.bsky.dev' // TODO
+    : 'http://localhost:2583'
 const ROOT_STATE_STORAGE_KEY = 'root'
 const STATE_FETCH_INTERVAL = 15e3
 
diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx
index 178b01dc2..9fca96461 100644
--- a/src/view/screens/Home.tsx
+++ b/src/view/screens/Home.tsx
@@ -8,6 +8,7 @@ import {useStores} from '../../state'
 import {FeedModel} from '../../state/models/feed-view'
 import {ScreenParams} from '../routes'
 import {s} from '../lib/styles'
+import {BUILD} from '../../env'
 
 export const Home = observer(function Home({
   visible,
@@ -53,7 +54,10 @@ export const Home = observer(function Home({
 
   return (
     <View style={s.flex1}>
-      <ViewHeader title="Bluesky" subtitle="Private Beta" />
+      <ViewHeader
+        title="Bluesky"
+        subtitle={`Private Beta${BUILD !== 'prod' ? ` [${BUILD}]` : ''}`}
+      />
       <Feed key="default" feed={defaultFeedView} scrollElRef={scrollElRef} />
       <FAB icon="pen-nib" onPress={onComposePress} />
     </View>
diff --git a/src/view/screens/Login.tsx b/src/view/screens/Login.tsx
index 759efd435..e386c8548 100644
--- a/src/view/screens/Login.tsx
+++ b/src/view/screens/Login.tsx
@@ -18,6 +18,7 @@ import {s, colors} from '../lib/styles'
 import {makeValidHandle, createFullHandle} from '../lib/strings'
 import {useStores, DEFAULT_SERVICE} from '../../state'
 import {ServiceDescription} from '../../state/models/session'
+import {BUILD} from '../../env'
 
 enum ScreenState {
   SigninOrCreateAccount,
@@ -71,7 +72,9 @@ const SigninOrCreateAccount = ({
       <View style={styles.hero}>
         <Logo />
         <Text style={styles.title}>Bluesky</Text>
-        <Text style={styles.subtitle}>[ private beta ]</Text>
+        <Text style={styles.subtitle}>
+          [ private beta {BUILD !== 'prod' ? `- ${BUILD} ` : ''}]
+        </Text>
       </View>
       <View style={s.flex1}>
         <TouchableOpacity style={styles.btn} onPress={onPressCreateAccount}>