-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add firebase-config.js for Web V9 Compat initialization #23
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||
| // Firebase V9 Compat Initialization | ||||||
| // Strict Silent Client Mandate: Do not add console.log or error logging. | ||||||
|
|
||||||
| const firebaseConfig = { | ||||||
| apiKey: "YOUR_API_KEY", | ||||||
| authDomain: "YOUR_AUTH_DOMAIN", | ||||||
| projectId: "YOUR_PROJECT_ID", | ||||||
| storageBucket: "YOUR_STORAGE_BUCKET", | ||||||
| messagingSenderId: "YOUR_MESSAGING_SENDER_ID", | ||||||
| appId: "YOUR_APP_ID" | ||||||
| }; | ||||||
|
|
||||||
| // Defensive execution to prevent UI thread blocking if the CDN fails to load | ||||||
| if (typeof firebase !== 'undefined') { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make the Firebase initialization more robust, it's a good practice to also check if a Firebase app has already been initialized before attempting to initialize it again. Calling
Suggested change
|
||||||
| try { | ||||||
| firebase.initializeApp(firebaseConfig); | ||||||
|
|
||||||
| } catch (e) { | ||||||
| // Absolute silence mandated. No console.error here. | ||||||
| // The failure will be naturally caught by experiment.js falling back to localStorage. | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committing configuration files with credential placeholders poses a security risk, as developers might accidentally commit real credentials. While Firebase web API keys are not considered secret, it's a security best practice to keep all credentials out of source control. This also simplifies managing different environments (e.g., development, production).
A safer pattern is to load these values from environment variables at build time. If a build process isn't in place, consider renaming this file to
firebase-config.js.example, addingfirebase-config.jsto.gitignore, and documenting that developers need to create this file locally from the example.