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 {
5858
5959 export class Apps {
6060 private _refCounter : RefCounter ;
61+ private _emulatedAdminApp ?: firebase . app . App ;
6162
6263 constructor ( ) {
6364 this . _refCounter = { } ;
@@ -105,12 +106,25 @@ export namespace apps {
105106 }
106107
107108 get admin ( ) : firebase . app . App {
109+ if ( this . _emulatedAdminApp ) {
110+ return this . _emulatedAdminApp ;
111+ }
112+
108113 if ( this . _appAlive ( '__admin__' ) ) {
109114 return firebase . app ( '__admin__' ) ;
110115 }
111116 return firebase . initializeApp ( this . firebaseArgs , '__admin__' ) ;
112117 }
113118
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+
114128 private get firebaseArgs ( ) {
115129 return _ . assign ( { } , firebaseConfig ( ) , {
116130 credential : firebase . credential . applicationDefault ( ) ,
You can’t perform that action at this time.
0 commit comments