Skip to content

Commit

Permalink
Merge pull request #13 from BFlorian91/dev
Browse files Browse the repository at this point in the history
Dev merge new firebase admin config and some minors update
  • Loading branch information
FlorianBx authored Dec 15, 2023
2 parents 1e68d64 + 576ec69 commit fbed363
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 56 deletions.
59 changes: 31 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
# Contributing to Code-Snippets-Vault
# Contribution Guide

Hey there! 👋 Excited you're interested in contributing to Code-Snippets-Vault! Your contributions help this project grow and improve. 🚀
## Welcome

## How to Contribute?
Thank you for considering contributing to Snippet Vault! We value your input and are excited to collaborate with you.

Here’s how you can jump in:
## How to Contribute

- Fixing bugs or resolving issues
- Improving or updating the documentation
- Suggesting or adding new features
- Optimizing existing code
- Writing tests to ensure stability
### Reporting Bugs

## Steps for Contributing
- **Check Existing Issues**: Before creating a new issue, please check if it's already reported.
- **Provide Details**: When reporting a bug, include as much information as possible to help us understand and fix it.

1. **Fork the Project**: Start by forking the repository to your account.
### Feature Suggestions

2. **Clone Your Fork**: Get your fork onto your local machine.
- **Open an Issue**: Discuss new features in an issue before working on them.
- **Describe Clearly**: Provide a clear and detailed explanation of the proposed feature.

3. **Create a New Branch**: Make a new branch for your updates. Give it a descriptive name.
### Pull Requests

4. **Make Your Changes**: Time to code! Implement your ideas.
- **Small Changes**: Keep your changes small and focused to make the review process easier.
- **Follow Style**: Adhere to the existing coding style of the project.
- **Test Your Code**: Ensure your code works correctly and add new tests if necessary.
- **Describe Your Changes**: In your pull request, explain what your changes do and why they are needed.

5. **Commit Your Changes**: Commit your changes with clear messages.
## Review Process

6. **Push Your Changes**: Push your changes to your fork.
Your contributions will be reviewed by the maintainers. They might request some changes or additional information.

7. **Open a Pull Request**: Create a pull request to the main branch. Describe what you've done.
## Getting Started

8. **Review and Discussion**: We'll review your PR. Be open to suggestions or questions.
- **Fork the Repo**: Create your own fork of the project.
- **Clone Your Fork**: `git clone [your-fork-url]`
- **Create a Branch**: `git checkout -b [your-branch-name]`

9. **Merge**: If all is good, your contributions will be merged into the project!
## Resources

## Best Practices
**The documentation is currently under development.**

- Add tests for new features.
- Update the documentation if you're adding or changing features.
- Small, focused pull requests are easier to review and merge.
- [Project Documentation](link-to-docs)

## Need Help?
## Thanks

If you have questions or need assistance, feel free to open an "issue". We're here to help!
Your contributions help make this project better. We appreciate your efforts!

## Thank You!
## Questions?

Your contributions make Code-Snippets-Vault a great project. Let's build something amazing together!
For any questions, feel free to contact bflorian91 at 2jggvgdztt@privaterelay.appleid.com.

Happy coding!
---

Thank you for contributing to our project!
28 changes: 0 additions & 28 deletions src/services/firebase/firebase.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,6 @@ import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
import { getFirestore } from "firebase/firestore";
import { getAuth, connectAuthEmulator } from "firebase/auth";
import admin from "firebase-admin";

async function initFirebaseAdmin() {
if (process.env.FIREBASE_TYPE) {
try {
const serviceAccount = {
type: process.env.FIREBASE_TYPE,
project_id: process.env.FIREBASE_PROJECT_ID,
private_key_id: process.env.FIREBASE_PRIVATE_KEY_ID,
private_key: process.env.FIREBASE_PRIVATE_KEY.replace(/\\n/g, "\n"),
client_email: process.env.FIREBASE_CLIENT_EMAIL,
client_id: process.env.FIREBASE_CLIENT_ID,
auth_uri: process.env.FIREBASE_AUTH_URI,
token_uri: process.env.FIREBASE_TOKEN_URI,
auth_provider_x509_cert_url:
process.env.FIREBASE_AUTH_PROVIDER_X509_CERT_URL,
client_x509_cert_url: process.env.FIREBASE_CLIENT_X509_CERT_URL,
};
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
} catch (error) {
console.error("Failed to initialize Firebase Admin:", error);
}
}
}

await initFirebaseAdmin();

const firebaseConfig = {
apiKey: import.meta.env.VITE_API_KEY,
Expand Down
28 changes: 28 additions & 0 deletions src/services/firebase/firebaseAdmin.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import admin from "firebase-admin";

async function initFirebaseAdmin() {
if (process.env.FIREBASE_TYPE) {
try {
const serviceAccount = {
type: process.env.FIREBASE_TYPE,
project_id: process.env.FIREBASE_PROJECT_ID,
private_key_id: process.env.FIREBASE_PRIVATE_KEY_ID,
private_key: process.env.FIREBASE_PRIVATE_KEY!.replace(/\\n/g, "\n"),
client_email: process.env.FIREBASE_CLIENT_EMAIL,
client_id: process.env.FIREBASE_CLIENT_ID,
auth_uri: process.env.FIREBASE_AUTH_URI,
token_uri: process.env.FIREBASE_TOKEN_URI,
auth_provider_x509_cert_url:
process.env.FIREBASE_AUTH_PROVIDER_X509_CERT_URL,
client_x509_cert_url: process.env.FIREBASE_CLIENT_X509_CERT_URL,
};
await admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
});
} catch (error) {
console.error("Failed to initialize Firebase Admin:", error);
}
}
}

initFirebaseAdmin();

0 comments on commit fbed363

Please sign in to comment.