How to get Firebase Project Name or ID from Cloud Function

后端 未结 6 1369
别跟我提以往
别跟我提以往 2021-01-01 12:25

I am using Cloud Functions and want to get the project name from within one of my Javascript server files. I know that value is stored in the .firebaserc, but I don\'t thin

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-01 13:06

    This worked for me. (node 10)

    const FIREBASE_CONFIG = process.env.FIREBASE_CONFIG && JSON.parse(process.env.FIREBASE_CONFIG);
    const projectId = FIREBASE_CONFIG.projectId;
    

提交回复
热议问题