backend-manager 5.0.5 → 5.0.7

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": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "Quick tools for developing Firebase functions",
5
5
  "main": "src/manager/index.js",
6
6
  "bin": {
@@ -70,16 +70,7 @@ function tryUrl(self) {
70
70
  : `${protocol}://${host}/${self.meta.name}`;
71
71
  }
72
72
  } else if (projectType === 'custom') {
73
- const server = Manager?._internal?.server;
74
- const addy = server ? server.address() : null;
75
- console.log('---TEST 1');
76
- console.log('---addy', addy);
77
- console.log('-------A', `${protocol}://${addy.address}:${addy.port}${path}`);
78
- console.log('-------B', `${protocol}://${host}${path}`);
79
-
80
- return addy
81
- ? `${protocol}://${addy.address}:${addy.port}${path}`
82
- : `${protocol}://${host}${path}`;
73
+ return `${protocol}://${host}${path}`;
83
74
  }
84
75
 
85
76
  return '';
@@ -643,6 +634,7 @@ BackendAssistant.prototype.authenticate = async function (options) {
643
634
  ? false
644
635
  : user.authenticated;
645
636
 
637
+
646
638
  // Validate BACKEND_MANAGER_KEY
647
639
  if (backendManagerKey && backendManagerKey === BACKEND_MANAGER_KEY) {
648
640
  // Update roles
@@ -107,12 +107,21 @@ Manager.prototype.init = function (exporter, options) {
107
107
  // Load package.json
108
108
  self.package = resolveProjectPackage(options.projectPackageDirectory || self.cwd);
109
109
 
110
+ // Set dotenv
111
+ try {
112
+ const env = require('dotenv').config();
113
+ } catch (e) {
114
+ self.assistant.error(new Error(`Failed to set up environment variables from .env file: ${e.message}`));
115
+ }
116
+
110
117
  // Load config
111
118
  self.config = merge(
112
119
  // Load basic config
113
120
  merge({}, requireJSON5(BEM_CONFIG_TEMPLATE_PATH, true), requireJSON5(self.project.backendManagerConfigPath, true)),
114
- // Load ENV config as a fallback
121
+ // Load runtimeconfig as a fallback
115
122
  requireJSON5(path.resolve(self.cwd, '.runtimeconfig.json'), options.projectType === 'firebase'),
123
+ // Load .ENV config because that is the new format
124
+ process.env.RUNTIME_CONFIG ? JSON5.parse(process.env.RUNTIME_CONFIG) : {},
116
125
  // Finally, load the functions config
117
126
  self.libraries.functions
118
127
  ? self.libraries.functions.config()
@@ -278,13 +287,6 @@ Manager.prototype.init = function (exporter, options) {
278
287
  self.setupCustomServer(exporter, options);
279
288
  }
280
289
 
281
- // Set dotenv
282
- try {
283
- const env = require('dotenv').config();
284
- } catch (e) {
285
- self.assistant.error(new Error(`Failed to set up environment variables from .env file: ${e.message}`));
286
- }
287
-
288
290
  // Setup LocalDatabase
289
291
  if (options.initializeLocalStorage) {
290
292
  self.storage();