backend-manager 2.3.19 → 2.3.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backend-manager",
3
- "version": "2.3.19",
3
+ "version": "2.3.20",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -32,6 +32,7 @@ Manager.prototype.init = function (exporter, options) {
32
32
  // Set options defaults
33
33
  options = options || {};
34
34
  options.initialize = typeof options.initialize === 'undefined' ? true : options.initialize;
35
+ options.log = typeof options.log === 'undefined' ? false : options.log;
35
36
  options.setupFunctions = typeof options.setupFunctions === 'undefined' ? true : options.setupFunctions;
36
37
  options.setupFunctionsLegacy = typeof options.setupFunctionsLegacy === 'undefined' ? true : options.setupFunctionsLegacy;
37
38
  options.initializeLocalStorage = typeof options.initializeLocalStorage === 'undefined' ? false : options.initializeLocalStorage;
@@ -39,8 +40,7 @@ Manager.prototype.init = function (exporter, options) {
39
40
  options.reportErrorsInDev = typeof options.reportErrorsInDev === 'undefined' ? false : options.reportErrorsInDev;
40
41
  options.firebaseConfig = options.firebaseConfig;
41
42
  options.useFirebaseLogger = typeof options.useFirebaseLogger === 'undefined' ? true : options.useFirebaseLogger;
42
- // options.serviceAccountPath = typeof options.serviceAccountPath === 'undefined' ? 'service-account.json' : options.serviceAccountPath;
43
- options.serviceAccountPath = typeof options.serviceAccountPath === 'undefined' ? undefined : options.serviceAccountPath;
43
+ options.serviceAccountPath = typeof options.serviceAccountPath === 'undefined' ? 'service-account.json' : options.serviceAccountPath;
44
44
  options.uniqueAppName = options.uniqueAppName || undefined;
45
45
  options.assistant = options.assistant || {};
46
46
  // options.assistant.optionsLogString = options.assistant.optionsLogString || undefined;
@@ -87,6 +87,10 @@ Manager.prototype.init = function (exporter, options) {
87
87
  require('firebase-functions/lib/logger/compat');
88
88
  }
89
89
 
90
+ if (options.log) {
91
+ self.assistant.log('process.env', process.env, {environment: 'production'})
92
+ }
93
+
90
94
  // Setup sentry
91
95
  if (self.options.sentry) {
92
96
  const sentryRelease = `${get(self.config, 'app.id') || self.project.projectId}@${self.package.version}`;
@@ -114,16 +118,18 @@ Manager.prototype.init = function (exporter, options) {
114
118
  // Setup options features
115
119
  if (self.options.initialize) {
116
120
  // console.log('Initializing:', self.project);
121
+ // console.log('----process.env.GOOGLE_APPLICATION_CREDENTIALS', process.env.GOOGLE_APPLICATION_CREDENTIALS);
117
122
  try {
118
- if (options.serviceAccountPath && options.uniqueAppName) {
123
+ // console.log('---process.env.GOOGLE_APPLICATION_CREDENTIALS', process.env.GOOGLE_APPLICATION_CREDENTIALS);
124
+ if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
125
+ self.libraries.initializedAdmin = self.libraries.admin.initializeApp();
126
+ } else {
119
127
  self.libraries.initializedAdmin = self.libraries.admin.initializeApp({
120
128
  credential: self.libraries.admin.credential.cert(
121
129
  require(path.resolve(self.cwd, options.serviceAccountPath))
122
130
  ),
123
131
  databaseURL: self.project.databaseURL,
124
132
  }, options.uniqueAppName);
125
- } else {
126
- self.libraries.initializedAdmin = self.libraries.admin.initializeApp();
127
133
  }
128
134
  } catch (e) {
129
135
  console.error('Failed to call .initializeApp()', e);