File tree 8 files changed +66
-2
lines changed
8 files changed +66
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Dev URL
2
- NEXT_PUBLIC_URL = YOUR_DEV_URL
2
+ NEXT_PUBLIC_URL =
3
+
4
+ # Owner Secret
5
+ NEXT_PUBLIC_OWNER_BEARER_TOKEN =
6
+
7
+ # Firebase
8
+ API_KEY =
9
+ AUTH_DOMAIN =
10
+ PROJECT_ID =
11
+ STORAGE_BUCKET =
12
+ MESSAGING_SENDER_ID =
13
+ APP_ID =
3
14
4
15
# GitHub
5
- GITHUB_TOKEN = YOUR_GITHUB_TOKEN
16
+ GITHUB_TOKEN =
Original file line number Diff line number Diff line change
1
+ {
2
+ "projects": {
3
+ "default": "portofolio-ccrsxx"
4
+ }
5
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "firestore" : {
3
+ "rules" : " firestore.rules" ,
4
+ "indexes" : " firestore.indexes.json"
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "indexes" : [],
3
+ "fieldOverrides" : []
4
+ }
Original file line number Diff line number Diff line change
1
+ rules_version = ' 2' ;
2
+ service cloud .firestore {
3
+ match / databases/ {database }/ documents {
4
+ match / {document =** } {
5
+ allow read , write : if true ;
6
+ }
7
+ }
8
+ }
Original file line number Diff line number Diff line change
1
+ import { initializeApp } from 'firebase/app' ;
2
+ import { getFirestore } from 'firebase/firestore' ;
3
+ import { getFirebaseConfig } from './config' ;
4
+
5
+ initializeApp ( getFirebaseConfig ( ) ) ;
6
+
7
+ export const db = getFirestore ( ) ;
Original file line number Diff line number Diff line change
1
+ import { collection } from 'firebase/firestore' ;
2
+ import { contentMetaConverter } from '@lib/types/meta' ;
3
+ import { db } from './app' ;
4
+
5
+ export const contentsCollection = collection ( db , 'contents' ) . withConverter (
6
+ contentMetaConverter
7
+ ) ;
Original file line number Diff line number Diff line change
1
+ const config = {
2
+ apiKey : process . env . API_KEY ,
3
+ authDomain : process . env . AUTH_DOMAIN ,
4
+ projectId : process . env . PROJECT_ID ,
5
+ storageBucket : process . env . STORAGE_BUCKET ,
6
+ messagingSenderId : process . env . MESSAGING_SENDER_ID ,
7
+ appId : process . env . APP_ID
8
+ } ;
9
+
10
+ type Config = typeof config ;
11
+
12
+ export function getFirebaseConfig ( ) : Config {
13
+ if ( Object . values ( config ) . some ( ( value ) => ! value ) )
14
+ throw new Error ( 'Firebase config is not set or incomplete' ) ;
15
+ return config ;
16
+ }
You can’t perform that action at this time.
0 commit comments