dart_firebase_admin
dart_firebase_admin copied to clipboard
Use environment variables for emulator
First of all, thank you making this SDK.
When using an emulator, I can specify port for different emulators using firebase.json.
Example firebase.json:
{
"emulators": {
"auth": {
"port": 9000
},
"firestore": {
"port": 8000
},
}
}
In that case, the SDK doesn't connect to the emulator because hardcoded values are used.
firebase_admin_app.dart:
void useEmulator() {
_isUsingEmulator = true;
authApiHost = Uri.http('127.0.0.1:9099', 'identitytoolkit.googleapis.com/');
firestoreApiHost = Uri.http('127.0.0.1:8080', '/');
}
Firebase documentation specifies the following environment variables that are being set by the emulator that can be used instead of hardcoded values:
FIREBASE_AUTH_EMULATOR_HOST Docs
FIRESTORE_EMULATOR_HOST Docs
I'm happy to contribute if you are busy.
Sure, I'd be happy to see a PR :)