"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getConfig = void 0;

var functions = _interopRequireWildcard(require("firebase-functions"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const getConfig = app => {
  const config = functions.config().config[app];
  const shopify = process.env.FUNCTIONS_EMULATOR ? config.shopify.development : config.shopify.production;
  const firebase = config.firebase;
  return {
    SHOPIFY_APP_URL: shopify.app_url,
    SHOPIFY_APP_NAME: shopify.app_name,
    SHOPIFY_APP_NAME_URL: shopify.app_name_url,
    SHOPIFY_API_SECRET: shopify.app_shared_secret,
    SHOPIFY_API_KEY: shopify.app_api_key,
    SHOPIFY_API_VERSION: shopify.app_api_version,
    SHOPIFY_API_SCOPES: shopify.app_scopes,
    SHOPIFY_APP_PLAN_NAME: shopify.app_plan_name,
    SHOPIFY_APP_PLAN_PRICE: shopify.app_plan_price,
    SHOPIFY_APP_PLAN_TRIAL: shopify.app_plan_trial,
    SHOPIFY_APP_PLAN_TEST: shopify.app_plan_test,
    SHOPIFY_APP_CUSTOM_PRIVATE: shopify.app_custom_private,
    SHOPIFY_APP_WEBHOOKS: shopify.app_webhooks,
    SHOPIFY_APP_STOREFRONT_ACCESS: shopify.app_storefront_access,
    FIREBASE_REGION: firebase.region,
    FIREBASE_PROJECT_ID: firebase.project_id,
    FIREBASE_CLIENT_EMAIL: firebase.client_email,
    FIREBASE_PRIVATE_KEY: firebase.private_key
  };
};

exports.getConfig = getConfig;
//# sourceMappingURL=config.js.map