Skip to content

Commit

Permalink
Use Firebase Auth Emulator host if present (#11958)
Browse files Browse the repository at this point in the history
* set up firebase for local cloud deploy

* remove log lines

* add empty line
  • Loading branch information
lmossman authored Apr 14, 2022
1 parent 5e00358 commit fa9c467
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from "react";
import { getAuth } from "firebase/auth";
import { getAuth, connectAuthEmulator } from "firebase/auth";

import { useConfig } from "packages/cloud/services/config";
import { FirebaseAppProvider, useFirebaseApp, AuthProvider } from "packages/firebaseReact";

const FirebaseAppSdksProvider: React.FC = ({ children }) => {
const config = useConfig();
const firebaseApp = useFirebaseApp();
const auth = getAuth(firebaseApp);
if (config.firebase.authEmulatorHost) {
connectAuthEmulator(auth, config.firebase.authEmulatorHost);
}

return <AuthProvider sdk={auth}>{children}</AuthProvider>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const cloudWindowConfigProvider: ConfigProvider<CloudConfig> = async () => {
firebase: {
apiKey: window.FIREBASE_API_KEY,
authDomain: window.FIREBASE_AUTH_DOMAIN,
authEmulatorHost: window.FIREBASE_AUTH_EMULATOR_HOST,
},
cloudApiUrl: window.CLOUD_API_URL,
};
Expand All @@ -44,6 +45,7 @@ const cloudEnvConfigProvider: ConfigProvider<CloudConfig> = async () => {
firebase: {
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
authEmulatorHost: process.env.REACT_APP_FIREBASE_AUTH_EMULATOR_HOST,
},
fullstory: {
orgId: process.env.REACT_APP_FULL_STORY_ORG,
Expand Down
1 change: 1 addition & 0 deletions airbyte-webapp/src/packages/cloud/services/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const cloudConfigExtensionDefault: CloudConfigExtension = {
firebase: {
apiKey: "",
authDomain: "",
authEmulatorHost: "",
},
fullstory: {
orgId: "",
Expand Down
2 changes: 2 additions & 0 deletions airbyte-webapp/src/packages/cloud/services/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare global {
FULLSTORY?: string;
FIREBASE_API_KEY?: string;
FIREBASE_AUTH_DOMAIN?: string;
FIREBASE_AUTH_EMULATOR_HOST?: string;
CLOUD_API_URL?: string;
}
}
Expand All @@ -18,6 +19,7 @@ export type CloudConfigExtension = {
firebase: {
apiKey: string;
authDomain: string;
authEmulatorHost: string;
};
intercom: {
appId: string;
Expand Down

0 comments on commit fa9c467

Please sign in to comment.