代码之家  ›  专栏  ›  技术社区  ›  Davtho1983

为不同的项目设置不同的firestore数据库,并为CI/CD开发和产品站点设置相同的回购协议

  •  0
  • Davtho1983  · 技术社区  · 5 年前

    {
      "projects": {
        "default": "host-test-xxxxx"
      },
      "targets": {
        "host-test-xxxxx": {
          "hosting": {
            "production": [
              "production-xxxxx"
            ]
          }
        },
         "host-test-dev": {
          "hosting": {
            "develop": [
              "develop-xxxxx"
            ]
          }
        }
      }
    }
    

    我的firebase.json是:

    {
      "hosting": [{
        "target": "develop",
        "public": "build",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ]
      },
      {
        "target": "production",
        "public": "build",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ]
      }
    ]
    }
    

    目标当前设置为默认值,我在该项目中设置了firestore。我想创建一个文件,获取当前目标的配置,如下所示:

    import * as firebase from 'firebase';
    import 'firebase/firestore';
    
    const firebaseConfig = {
        apiKey: "$myAPIKEY",
        projectId: "$myPROJECTID",
        appId: "$myAPPID",
    };
    
    firebase.initializeApp(firebaseConfig);
    
    
    export default firebase;
    

    0 回复  |  直到 5 年前