UNPKG

firebase-tools

Version:
27 lines (26 loc) • 954 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEnvironmentName = getEnvironmentName; exports.getAutoinitEnvVars = getAutoinitEnvVars; const error_1 = require("../error"); const config_1 = require("./config"); function getEnvironmentName(apphostingYamlFileName) { const found = apphostingYamlFileName.match(config_1.APPHOSTING_YAML_FILE_REGEX); if (!found || found.length < 2 || !found[1]) { throw new error_1.FirebaseError("Invalid apphosting environment file"); } return found[1].replaceAll(".", ""); } function getAutoinitEnvVars(webappConfig) { if (!webappConfig) { return {}; } return { FIREBASE_WEBAPP_CONFIG: JSON.stringify(webappConfig), FIREBASE_CONFIG: JSON.stringify({ databaseURL: webappConfig.databaseURL, storageBucket: webappConfig.storageBucket, projectId: webappConfig.projectId, }), }; }