Add staging env

zio/stable
Paul Frazee 2022-11-11 15:02:19 -06:00
parent 38ed9a7943
commit 210082be93
11 changed files with 41 additions and 14 deletions

1
.env
View File

@ -1 +0,0 @@
REACT_APP_AUTH_LOBBY = 'http://localhost:3001'

1
.env.development 100644
View File

@ -0,0 +1 @@
REACT_APP_BUILD = 'staging'

1
.env.production 100644
View File

@ -0,0 +1 @@
REACT_APP_BUILD = 'staging'

View File

@ -4,7 +4,7 @@ module.exports = {
[ [
'module:react-native-dotenv', 'module:react-native-dotenv',
{ {
// envName: 'APP_ENV', envName: 'APP_ENV',
moduleName: '@env', moduleName: '@env',
path: '.env', path: '.env',
blocklist: null, blocklist: null,

View File

@ -7,7 +7,7 @@
"ios": "react-native run-ios --simulator=\"iPhone 14\"", "ios": "react-native run-ios --simulator=\"iPhone 14\"",
"web": "react-scripts start", "web": "react-scripts start",
"start": "react-native start", "start": "react-native start",
"dev-env": "dev-env", "clean-cache": "rm -rf node_modules/.cache/babel-loader/*",
"test": "jest", "test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx" "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
}, },

View File

@ -1,8 +1,13 @@
// @ts-ignore types not available -prf // @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') { if (typeof REACT_APP_BUILD !== 'string') {
throw new Error('ENV: No auth lobby provided') 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

View File

@ -1,5 +1,10 @@
if (typeof process.env.REACT_APP_AUTH_LOBBY !== 'string') { if (typeof process.env.REACT_APP_BUILD !== 'string') {
throw new Error('ENV: No auth lobby provided') 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

View File

@ -3,8 +3,14 @@ import {sessionClient as AtpApi} from '../third-party/api'
import {RootStoreModel} from './models/root-store' import {RootStoreModel} from './models/root-store'
import * as libapi from './lib/api' import * as libapi from './lib/api'
import * as storage from './lib/storage' import * as storage from './lib/storage'
import {BUILD} from '../env'
export const DEFAULT_SERVICE = 'http://localhost:2583' 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 ROOT_STATE_STORAGE_KEY = 'root'
const STATE_FETCH_INTERVAL = 15e3 const STATE_FETCH_INTERVAL = 15e3

View File

@ -8,6 +8,7 @@ import {useStores} from '../../state'
import {FeedModel} from '../../state/models/feed-view' import {FeedModel} from '../../state/models/feed-view'
import {ScreenParams} from '../routes' import {ScreenParams} from '../routes'
import {s} from '../lib/styles' import {s} from '../lib/styles'
import {BUILD} from '../../env'
export const Home = observer(function Home({ export const Home = observer(function Home({
visible, visible,
@ -53,7 +54,10 @@ export const Home = observer(function Home({
return ( return (
<View style={s.flex1}> <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} /> <Feed key="default" feed={defaultFeedView} scrollElRef={scrollElRef} />
<FAB icon="pen-nib" onPress={onComposePress} /> <FAB icon="pen-nib" onPress={onComposePress} />
</View> </View>

View File

@ -18,6 +18,7 @@ import {s, colors} from '../lib/styles'
import {makeValidHandle, createFullHandle} from '../lib/strings' import {makeValidHandle, createFullHandle} from '../lib/strings'
import {useStores, DEFAULT_SERVICE} from '../../state' import {useStores, DEFAULT_SERVICE} from '../../state'
import {ServiceDescription} from '../../state/models/session' import {ServiceDescription} from '../../state/models/session'
import {BUILD} from '../../env'
enum ScreenState { enum ScreenState {
SigninOrCreateAccount, SigninOrCreateAccount,
@ -71,7 +72,9 @@ const SigninOrCreateAccount = ({
<View style={styles.hero}> <View style={styles.hero}>
<Logo /> <Logo />
<Text style={styles.title}>Bluesky</Text> <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>
<View style={s.flex1}> <View style={s.flex1}>
<TouchableOpacity style={styles.btn} onPress={onPressCreateAccount}> <TouchableOpacity style={styles.btn} onPress={onPressCreateAccount}>

View File

@ -34,3 +34,6 @@ Paul's todo list
- Auth token refresh seems broken - Auth token refresh seems broken
- Check that sub components arent reloading too much - Check that sub components arent reloading too much
- Titles are getting screwed up (possibly swipe related) - Titles are getting screwed up (possibly swipe related)
> Dont suggest self for follows
> Double post on post?
> Handle no displayname everywhere