Skip to content

Commit

Permalink
Firebase init and config
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel O'Brien committed Nov 22, 2021
1 parent 7ac67a6 commit a4058fd
Show file tree
Hide file tree
Showing 8 changed files with 1,327 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "project-manager-58279"
}
}
23 changes: 23 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"storage": {
"rules": "storage.rules"
}
}
4 changes: 4 additions & 0 deletions firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"indexes": [],
"fieldOverrides": []
}
9 changes: 9 additions & 0 deletions firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if
request.time < timestamp.date(2021, 12, 22);
}
}
}
1,250 changes: 1,250 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"firebase": "8.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
Expand Down
27 changes: 27 additions & 0 deletions src/firebase/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import firebase from 'firebase/app';

import 'firebase/firestore';
import 'firebase/auth';

const firebaseConfig = {
apiKey: 'AIzaSyCLegk2N8jZe84zkBteEbIlrhKjQRJzeXs',
authDomain: 'project-manager-58279.firebaseapp.com',
projectId: 'project-manager-58279',
storageBucket: 'project-manager-58279.appspot.com',
messagingSenderId: '422599832483',
appId: '1:422599832483:web:90f64e2398f1588d8ca016',
measurementId: 'G-08LC96BQKV',
};

// init firebase
firebase.initializeApp(firebaseConfig);

// init services
const projectFirestore = firebase.firestore();
const projectAuth = firebase.auth();

// timestamp

const timestamp = firebase.firestore.Timestamp;

export { projectAuth, projectFirestore, timestamp };
8 changes: 8 additions & 0 deletions storage.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth!=null;
}
}
}

0 comments on commit a4058fd

Please sign in to comment.