简体   繁体   English

如何管理连接到同一项目的 2 个 Firebase 应用程序

[英]How do I manage 2 Firebase apps connecting to the same project

I have 2 versions of a Firebase app, call them regular and pro, such that users of the regular app interact with those of the pro app, and thusly need access to the same Firestore database and same superset of Firebase cloud functions.我有 2 个版本的 Firebase 应用程序,称它们为普通版和专业版,以便普通版应用程序的用户与专业版应用程序的用户交互,因此需要访问相同的 Firestore 数据库和 Firebase 云函数的相同超集。 The relationship is such that there are a set of cloud functions that the regular app would use exclusively, a set that the pro app would use exclusively and a set that both would use.这种关系是这样的,即有一组常规应用程序将专门使用的云功能,一组专业应用程序将专门使用的一组云功能,以及一组两者都将使用的一组。 The regular and pro apps are different enough to warrant separate projects, and thusly have separate git repositories.常规应用程序和专业应用程序的差异足以保证单独的项目,因此具有单独的 git 存储库。 This is perfectly fine in most situations, but it still has the following problems:这在大多数情况下都很好,但它仍然存在以下问题:

  1. When I add a cloud function to the regular app, that same function will not automatically be updated in the pro app git repo.当我将云 function 添加到常规应用程序时,相同的 function 不会在专业应用程序 git 存储库中自动更新。 As you can imagine this will cause grief in maintaining a consistent store of cloud functions.正如您可以想象的那样,这将导致难以维护一致的云功能存储。 I am fine having a superset of cloud functions that can be accessed by both projects, and managing access to them as normal, but I am not seeing a way to maintain this superset of cloud functions across both git repos.我很高兴拥有两个项目都可以访问的云功能超集,并正常管理对它们的访问,但我没有看到一种方法可以在两个 git 存储库中维护这个云功能超集。 Furthermore, there are also foreseeable problems if I update the cloud functions from different repos in succession.此外,如果我从不同的 repos 中连续更新云功能,也会出现可预见的问题。
  2. This same principal applies to the Firestore rules as well.同样的原则也适用于 Firestore 规则。 I need to maintain the same rules across both apps and am not sure the best way to do this.我需要在两个应用程序中保持相同的规则,并且不确定执行此操作的最佳方法。
  3. The former two problems get worse when other developers are added in the future and we have to maintain that consistent superset of cloud functions across the branches contributed by these new developers.当未来添加其他开发人员时,前两个问题会变得更糟,我们必须在这些新开发人员贡献的分支中保持一致的云功能超集。

One other note: my app is built with Ionic 4.另一个注意事项:我的应用程序是用 Ionic 4 构建的。

Any suggestions with this are much appreciated.对此的任何建议都非常感谢。

The regular and pro apps are different enough to warrant separate projects, and thusly have separate git repositories.常规应用程序和专业应用程序的差异足以保证单独的项目,因此具有单独的 git 存储库。

It honestly sounds like this choice is causing you problems, so I'd recommend reconsidering.老实说,这个选择听起来会给你带来麻烦,所以我建议你重新考虑。

If both apps make calls against the same backend (Cloud Functions + security rules) then the backend for both apps should be stored in a single place at least.如果两个应用程序都针对同一个后端(云功能+安全规则)进行调用,那么两个应用程序的后端至少应该存储在一个地方。

The apps themselves could be in separate repositories, but I'd probably just put them as subdirectories in the same rep as the backend too.应用程序本身可以位于单独的存储库中,但我可能只是将它们作为子目录放在与后端相同的代表中。 For example in a top-level structure like this例如在这样的顶级结构中

app
  regular app files go here
pro
  pro app files go here
rules
  security rules go here
functions
  cloud functions code goes here

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我将 firebase 与节点 js 连接时。 我得到了这个错误。 我如何修复此错误并将 firebase 连接到 node express 项目 - when I connecting firebase with node js. I got this error. how I fix this error and connect firebase to node express project 如何使用连接到 Firebase Firestore 的 Flutter 管理导航路线表 - How do I manage navigation routes table with Flutter connected to Firebase Firestore 如何从项目中删除 Firebase 产品(或功能)? - How do I delete a Firebase product (or feature) from a project? 如何将 firebase 添加到我的反应项目中? - How do I add firebase to my react project? 如何在 firebase 上保存相同 JS 代码的多个实例? - How do I save multiple instances of the same JS code on firebase? 我如何在 firebase 数据库中使用相同的键来总结值 - How do i sum up values with the same key in firebase database 我应该创建多个 Firebase 项目还是将多个应用程序添加到单个 Firebase 项目? - Should I create multiple Firebase projects or add multiple apps to a single Firebase project? 如何在 React 项目中设置 firebase 以连接到正确的 firebase 控制台帐户? - How do I set up firebase in a react project to connect to the right firebase console account? 如何将用户名存储在包含 email 和同一用户发送的聊天消息的同一文档中? 在 flutter 和 firebase - How do I store the username in the same document that contains the email and chat messages sent by the same user? in flutter and firebase 我是否需要 Firebase 项目才能使用 Firebase App Check? - Do I need a Firebase project to use Firebase App Check?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM