File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change
1
+ feature - Add a helper function for the Firebase Emulator suite.
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export namespace apps {
58
58
59
59
export class Apps {
60
60
private _refCounter : RefCounter ;
61
+ private _emulatedAdminApp ?: firebase . app . App ;
61
62
62
63
constructor ( ) {
63
64
this . _refCounter = { } ;
@@ -105,12 +106,25 @@ export namespace apps {
105
106
}
106
107
107
108
get admin ( ) : firebase . app . App {
109
+ if ( this . _emulatedAdminApp ) {
110
+ return this . _emulatedAdminApp ;
111
+ }
112
+
108
113
if ( this . _appAlive ( '__admin__' ) ) {
109
114
return firebase . app ( '__admin__' ) ;
110
115
}
111
116
return firebase . initializeApp ( this . firebaseArgs , '__admin__' ) ;
112
117
}
113
118
119
+ /**
120
+ * This function allows the Firebase Emulator Suite to override the FirebaseApp instance
121
+ * used by the Firebase Functions SDK. Developers should never call this function for
122
+ * other purposes.
123
+ */
124
+ setEmulatedAdminApp ( app : firebase . app . App ) {
125
+ this . _emulatedAdminApp = app ;
126
+ }
127
+
114
128
private get firebaseArgs ( ) {
115
129
return _ . assign ( { } , firebaseConfig ( ) , {
116
130
credential : firebase . credential . applicationDefault ( ) ,
You can’t perform that action at this time.
0 commit comments