File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ * Added support for overriding the name of the Firestore Default Database
6+ ([ #209 ] ( https://github.com/kreait/laravel-firebase/pull/209 ) )
7+
58## 5.5.0 - 2023-11-30
69
710* Added support for PHP 8.3
Original file line number Diff line number Diff line change 6262 'tenant_id ' => env ('FIREBASE_AUTH_TENANT_ID ' ),
6363 ],
6464
65+ /*
66+ * ------------------------------------------------------------------------
67+ * Firestore Component
68+ * ------------------------------------------------------------------------
69+ */
70+
71+ 'firestore ' => [
72+
73+ /*
74+ * If you want to access a Firestore database other than the default database,
75+ * enter its name here.
76+ *
77+ * By default, the Firestore client will connect to the `(default)` database.
78+ *
79+ * https://firebase.google.com/docs/firestore/manage-databases
80+ */
81+
82+ // 'database' => env('FIREBASE_FIRESTORE_DATABASE'),
83+ ],
84+
6585 /*
6686 * ------------------------------------------------------------------------
6787 * Firebase Realtime Database
Original file line number Diff line number Diff line change @@ -84,6 +84,10 @@ protected function configure(string $name): FirebaseProject
8484 $ factory = $ factory ->withDatabaseAuthVariableOverride ($ authVariableOverride );
8585 }
8686
87+ if ($ firestoreDatabase = $ config ['firestore ' ]['database ' ] ?? null ) {
88+ $ factory = $ factory ->withFirestoreDatabase ($ firestoreDatabase );
89+ }
90+
8791 if ($ defaultStorageBucket = $ config ['storage ' ]['default_bucket ' ] ?? null ) {
8892 $ factory = $ factory ->withDefaultStorageBucket ($ defaultStorageBucket );
8993 }
Original file line number Diff line number Diff line change @@ -276,6 +276,20 @@ public function it_uses_the_laravel_cache_as_verifier_cache(): void
276276 $ this ->assertInstanceOf (CacheItemPoolInterface::class, $ property ->getValue ($ factory ));
277277 }
278278
279+ /**
280+ * @test
281+ */
282+ public function it_overrides_the_default_firestore_database (): void
283+ {
284+ config (['firebase.projects.app.firestore.database ' => 'override-database ' ]);
285+ $ projectName = $ this ->app ->config ->get ('firebase.default ' );
286+ $ factory = $ this ->factoryForProject ($ projectName );
287+
288+ $ property = $ this ->getAccessibleProperty ($ factory , 'firestoreClientConfig ' );
289+
290+ $ this ->assertEquals ('override-database ' , $ property ->getValue ($ factory )['database ' ]);
291+ }
292+
279293 /**
280294 * @test
281295 */
You can’t perform that action at this time.
0 commit comments