Compare commits

...

4 Commits

Author SHA1 Message Date
Austin Chen
03567ad5cf Set cloud functions environment 2022-03-08 19:47:35 -08:00
Austin Chen
9974de574a Link to Supersynchronous's logo 2022-03-08 19:26:48 -08:00
Austin Chen
581319cc53 Add config and scripts for Supersync 2022-03-08 19:24:40 -08:00
Austin Chen
245036ea69 Provision a new instance for Supersynchronous 2022-03-08 18:57:44 -08:00
6 changed files with 44 additions and 14 deletions

View File

@ -1,5 +1,6 @@
import { DEV_CONFIG } from './dev' import { DEV_CONFIG } from './dev'
import { EnvConfig, PROD_CONFIG } from './prod' import { EnvConfig, PROD_CONFIG } from './prod'
import { SUPERSYNC_CONFIG } from './supersync'
import { THEOREMONE_CONFIG } from './theoremone' import { THEOREMONE_CONFIG } from './theoremone'
const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD' const ENV = process.env.NEXT_PUBLIC_FIREBASE_ENV ?? 'PROD'
@ -8,6 +9,7 @@ const CONFIGS = {
PROD: PROD_CONFIG, PROD: PROD_CONFIG,
DEV: DEV_CONFIG, DEV: DEV_CONFIG,
THEOREMONE: THEOREMONE_CONFIG, THEOREMONE: THEOREMONE_CONFIG,
SUPERSYNC: SUPERSYNC_CONFIG,
} }
// @ts-ignore // @ts-ignore
export const ENV_CONFIG: EnvConfig = CONFIGS[ENV] export const ENV_CONFIG: EnvConfig = CONFIGS[ENV]

27
common/envs/supersync.ts Normal file
View File

@ -0,0 +1,27 @@
import { EnvConfig, PROD_CONFIG } from './prod'
export const SUPERSYNC_CONFIG: EnvConfig = {
domain: 'supersync.manifold.markets',
firebaseConfig: {
apiKey: 'AIzaSyCV2THIZ_DPuFe4SI033uE13XNjzBLHPGM',
authDomain: 'supersync-manifold.firebaseapp.com',
projectId: 'supersync-manifold',
storageBucket: 'supersync-manifold.appspot.com',
messagingSenderId: '385180520313',
appId: '1:385180520313:web:e4d99bf5b888d76b43a9a8',
measurementId: 'G-C28MP0GSDJ',
},
adminEmails: [...PROD_CONFIG.adminEmails],
whitelistEmail: '@supsync.com',
moneyMoniker: 'S$',
visibility: 'PRIVATE',
faviconPath: '/favicon.ico',
navbarLogoPath:
'https://supsync.com/content/images/2021/03/supsync-logo-invert-1.svg',
newQuestionPlaceholders: [
'Will we have at least 5 new team members by the end of this quarter?',
'Will we meet or exceed our goals this sprint?',
'Will we sign on 3 or more new clients this month?',
'Will Paul shave his beard by the end of the month?',
],
}

View File

@ -5,14 +5,16 @@ service cloud.firestore {
match /databases/{database}/documents { match /databases/{database}/documents {
function isAdmin() { function isAdmin() {
return request.auth.uid == 'igi2zGXsfxYPgB0DJTXVJVmwCOr2' // Austin return request.auth.uid == 'P0UsBCW7VmSR0co39kFlsjxWgLQ2' // Austin
|| request.auth.uid == '5LZ4LgYuySdL1huCWe7bti02ghx2' // James // || request.auth.uid == 'czxKSN1Z03Mzu7UqIio3ppM0eDt2' // David
|| request.auth.uid == 'tlmGNz9kjXc2EteizMORes4qvWl2' // Stephen }
|| request.auth.uid == 'IPTOzEqrpkWmEzh6hwvAyY9PqFb2' // Manifold
function isAuthed() {
return request.auth != null
} }
match /users/{userId} { match /users/{userId} {
allow read; allow read: if isAuthed();
allow update: if resource.data.id == request.auth.uid allow update: if resource.data.id == request.auth.uid
&& request.resource.data.diff(resource.data).affectedKeys() && request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle']); .hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle']);
@ -23,7 +25,7 @@ service cloud.firestore {
} }
match /contracts/{contractId} { match /contracts/{contractId} {
allow read; allow read: if isAuthed();
allow update: if request.resource.data.diff(resource.data).affectedKeys() allow update: if request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['description', 'closeTime', 'tags', 'lowercaseTags']); .hasOnly(['description', 'closeTime', 'tags', 'lowercaseTags']);
allow update: if isAdmin(); allow update: if isAdmin();
@ -31,25 +33,25 @@ service cloud.firestore {
} }
match /{somePath=**}/bets/{betId} { match /{somePath=**}/bets/{betId} {
allow read; allow read: if isAuthed();
} }
match /{somePath=**}/comments/{commentId} { match /{somePath=**}/comments/{commentId} {
allow read; allow read: if isAuthed();
allow create: if request.auth != null; allow create: if request.auth != null;
} }
match /{somePath=**}/answers/{answerId} { match /{somePath=**}/answers/{answerId} {
allow read; allow read: if isAuthed();
} }
match /folds/{foldId} { match /folds/{foldId} {
allow read; allow read: if isAuthed();
allow update, delete: if request.auth.uid == resource.data.curatorId; allow update, delete: if request.auth.uid == resource.data.curatorId;
} }
match /{somePath=**}/followers/{userId} { match /{somePath=**}/followers/{userId} {
allow read; allow read: if isAuthed();
allow write: if request.auth.uid == userId; allow write: if request.auth.uid == userId;
} }
} }

1
functions/.env Normal file
View File

@ -0,0 +1 @@
NEXT_PUBLIC_FIREBASE_ENV=SUPERSYNC

View File

@ -1,6 +1,3 @@
# Secrets
.env*
# Compiled JavaScript files # Compiled JavaScript files
lib/**/*.js lib/**/*.js
lib/**/*.js.map lib/**/*.js.map

View File

@ -7,6 +7,7 @@
"devdev": "NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=DEV next dev -p 3000\" \"FIREBASE_ENV=DEV yarn ts --watch\"", "devdev": "NEXT_PUBLIC_FIREBASE_ENV=DEV concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=DEV next dev -p 3000\" \"FIREBASE_ENV=DEV yarn ts --watch\"",
"dev:dev": "yarn devdev", "dev:dev": "yarn devdev",
"dev:the": "NEXT_PUBLIC_FIREBASE_ENV=THEOREMONE concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=THEOREMONE next dev -p 3000\" \"FIREBASE_ENV=THEOREMONE yarn ts --watch\"", "dev:the": "NEXT_PUBLIC_FIREBASE_ENV=THEOREMONE concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=THEOREMONE next dev -p 3000\" \"FIREBASE_ENV=THEOREMONE yarn ts --watch\"",
"dev:ss": "NEXT_PUBLIC_FIREBASE_ENV=SUPERSYNC concurrently -n NEXT,TS -c magenta,cyan \"FIREBASE_ENV=SUPERSYNC next dev -p 3000\" \"FIREBASE_ENV=SUPERSYNC yarn ts --watch\"",
"ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty", "ts": "tsc --noEmit --incremental --preserveWatchOutput --pretty",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",