Move more logic into access
This commit is contained in:
parent
bb897a0a0f
commit
21180c2ff0
|
@ -1,7 +1,17 @@
|
||||||
|
const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD'
|
||||||
|
|
||||||
export function isWhitelisted(email?: string) {
|
export function isWhitelisted(email?: string) {
|
||||||
return email && (email.endsWith('@theoremone.co') || isAdmin(email))
|
switch (ENV) {
|
||||||
|
case 'THEOREMONE':
|
||||||
|
return email && (email.endsWith('@theoremone.co') || isAdmin(email))
|
||||||
|
case 'PROD':
|
||||||
|
case 'DEV':
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Before open sourcing, we should turn these into env vars
|
||||||
export function isAdmin(email: string) {
|
export function isAdmin(email: string) {
|
||||||
const ADMINS = [
|
const ADMINS = [
|
||||||
'akrolsmir@gmail.com', // Austin
|
'akrolsmir@gmail.com', // Austin
|
||||||
|
@ -9,17 +19,12 @@ export function isAdmin(email: string) {
|
||||||
'taowell@gmail.com', // Stephen
|
'taowell@gmail.com', // Stephen
|
||||||
'manticmarkets@gmail.com', // Manifold
|
'manticmarkets@gmail.com', // Manifold
|
||||||
]
|
]
|
||||||
|
if (ENV === 'THEOREMONE') {
|
||||||
|
ADMINS.push('david.glidden@theoremone.co')
|
||||||
|
}
|
||||||
return ADMINS.includes(email)
|
return ADMINS.includes(email)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD'
|
|
||||||
|
|
||||||
export const DOMAINS = {
|
|
||||||
PROD: 'manifold.markets',
|
|
||||||
DEV: 'manifold.markets',
|
|
||||||
THEOREMONE: 'theoremone.manifold.markets',
|
|
||||||
}
|
|
||||||
|
|
||||||
export const FIREBASE_CONFIGS = {
|
export const FIREBASE_CONFIGS = {
|
||||||
PROD: {
|
PROD: {
|
||||||
apiKey: 'AIzaSyDp3J57vLeAZCzxLD-vcPaGIkAmBoGOSYw',
|
apiKey: 'AIzaSyDp3J57vLeAZCzxLD-vcPaGIkAmBoGOSYw',
|
||||||
|
@ -50,6 +55,11 @@ export const FIREBASE_CONFIGS = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DOMAINS = {
|
||||||
|
PROD: 'manifold.markets',
|
||||||
|
DEV: 'manifold.markets',
|
||||||
|
THEOREMONE: 'theoremone.manifold.markets',
|
||||||
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const DOMAIN = DOMAINS[ENV]
|
export const DOMAIN = DOMAINS[ENV]
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
Loading…
Reference in New Issue
Block a user