🪟 Windows ServerWindows-Update sperrt Domain-Nutzer aus | heise online(17.09.2026 um 11:01 Uhr)
🪟 Windows ServerWindows Server 2022: Mainstream-Support endet bald - it-daily.net(17.09.2026 um 11:08 Uhr)
🕵️ SicherheitslückenCVE-2026-1880 | ASUS DriverHub prior 1.0.6.12 toctou (EUVD-2026-23155)(17.09.2026 um 12:00 Uhr)
🪟 Windows ServerWindows-Update sperrt Domain-Nutzer aus | heise online(17.09.2026 um 11:01 Uhr)
🪟 Windows ServerWindows Server 2022: Mainstream-Support endet bald - it-daily.net(17.09.2026 um 11:08 Uhr)
🕵️ SicherheitslückenCVE-2026-1880 | ASUS DriverHub prior 1.0.6.12 toctou (EUVD-2026-23155)(17.09.2026 um 12:00 Uhr)
🔧 Programmierung 🕛 vor 7 Monaten 12 Min Lesezeit
0

Managing development, staging and production environments in firebase

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht
📺
dev.to




Hello world!



This is the second post of Building Firebase Apps with

  • , NOTE: with this approach it is mandatory to setup the correct firebase rules so others can’t abuse your data and app.



    Use Firebase Functions



    Second approach is to use firebase functions as backend server and write functions that act as a api for your client apps to use, in this approach, client apps can use the firebase client SDK to call the function or write their own custom api handler to make the network calls to firebase functions api endpoints. Here is how to do it in code





    • .



      Steps of pointing a custom domain to your functions is also different, with v2 functions, you can do it from the ,



      Step 2 - Initialise project aliases in .firebaserc file



      This is what .firebaserc looks like




      CODE
      {
      "projects": {
      "default": "<prod-or-stage-project-id>",
      "dev": "stage-project-id",
      "prod": "prod-project-id",
      "stage": "stage-project-id"
      },
      "targets": {},
      "etags": {}
      }






      Step 3 - Set the correct alias and project id in the build command




      CODE
          "serve": "firebase use dev && npm run build && firebase emulators:start --import ./.db --export-on-exit ./.db",
      "deploy": "firebase use prod && firebase deploy --only functions --project <prod-project-id>",
      "deploy:stage": "firebase use stage && firebase deploy --only functions --project <stage-project-id>",






      Once this is done, and when we run the commands, firebase initialises the process.env.GCLOUD_PROJECT with the correct firebase project id and process.env.FUNCTIONS_EMULATOR boolean to tell if the emulator is running, we will use these two variables to find the environment, here is how we do it in code, and note that the code below must be executed at the very top of the root file of your project, so others can access the environment variables loaded using the dotenv package.




      CODE
      const projectId = process.env.GCLOUD_PROJECT;
      const isEmulatorRunning = process.env.FUNCTIONS_EMULATOR === "true";
      let env;

      if (projectId === "prod-project-id") {
      env = "prod";
      } else if (projectId === "stage-project-id" && !isEmulatorRunning) {
      env = "stage";
      } else {
      env = "dev";
      }

      require("dotenv").config({path: `.env.${env}`});






      Once, the above code is executed, you can read the environment variables anywhere in your codebase. The code below will now work




      CODE
      // In this code, both the variables -- BASE_URL and APP_ENV will be available with the correct values

      const functionsConfig = {
      maxInstances: 1,
      cors: process.env.BASE_URL,
      timeoutSeconds: 540,
      };

      exports.api = onCall(functionsConfig, (request) => {
      console.log('APP_ENV', process.env.APP_ENV);
      });






      Let me know if there is another way to achieve this, this is what i have tested and it works just fine for me.






      Managing Staging & Production Environments with Firebase



      To have a clear, separate and truly independent environments in firebase, , and this is how you setup a cloudflare rule to block public access to your staging frontend and backend URLs.



      VPN Rule

      Vollständiger Original-Artikel
      Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
      ↗ Original-Artikel auf dev.to lesen
  • Wie bewertest du diesen Beitrag?
    1 Klick Feedback
    Teilen mit Netzwerk & Team:

    Community-Analysen & Experten-Meinungen 0

    Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
    Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
    Community Pulse: Relevanz-Einschätzung
    1 Klick Experten-Votum
    🔴 Akute Relevanz 0%
    🟡 In Evaluierung 0%
    🟢 Keine Auswirkung 0%
    Spannende Innovation 0%
    Verwandte Story-Cluster & Quellen (Vektor-KI)
    Port 8095 Engine
    1 Quelle
    Deutschlandticket: Betrüger locken mit falschen Gewinnen
    1 Quelle
    Umbau von Rechenzentren im laufenden Betrieb
    1 Quelle
    Ofcom discovers issuing Online Safety Act fines is easier than collecting them
    Ähnliche Beiträge
    🔍 Verwandte News

    Auch interessante Nachrichten Managing development, staging and production environments in firebase

    Thematisch verwandte Begriffe: Managing, development, staging, production · 6 Treffer

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...