Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use environment variables for emulator #52

Open
dinko7 opened this issue Sep 29, 2024 · 1 comment
Open

Use environment variables for emulator #52

dinko7 opened this issue Sep 29, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@dinko7
Copy link

dinko7 commented Sep 29, 2024

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.

@dinko7 dinko7 added the enhancement New feature or request label Sep 29, 2024
@rrousselGit
Copy link
Collaborator

Sure, I'd be happy to see a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants