簡體   English   中英

如何在 Firebase 函數中使用 CircleCI 環境變量

[英]How to use CircleCI Environment Variables in Firebase Functions

我是 Continous Intregration 的新手,最近我在 CircleCI 中設置了我的第一個項目。 不幸的是,我似乎沒有完全按預期工作。

我想將我的應用程序部署到 Firebase(托管和函數)。 當然我在CircleCI的項目中添加了環境變量。

但是 Firebase 函數無法訪問我的環境變量,因此遇到了錯誤。

在 Functions 文件夾中,我創建了一個新的 nodejs 應用程序,包括。 dotenv 包,我用 process.env.CIRCLECI_VARIABLE 調用變量。

如果有人能給我提示缺少的東西,那就太好了。

配置文件

version: 2.1

jobs:
  build:
    docker:
      - image: circleci/node:10
    steps:
      - checkout
      - run:
          name: Install packages
          command: yarn install
      - run:
          name: Build project
          command: yarn build
      - run:
          name: Install functions packages
          command: cd ./functions && yarn install
  deploy:
    docker:
      - image: circleci/node:10
    steps:
      - checkout
      - run:
          name: Install packages
          command: yarn install
      - run:
          name: Build project
          command: yarn build
      - run:
          name: Install functions packages
          command: cd ./functions && yarn install
      - run:
          name: Installing Firebase-Tools
          command: yarn add firebase-tools
      - run:
          name: Firebase Deploy
          command: ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
workflows:
  build_and_deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

我找到了我不知道必須將環境變量添加到 Google Cloud Function 的解決方案。 現在一切都按預期工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM