backend-manager 2.5.0 → 2.5.1
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 +2 -2
- package/src/cli/cli.js +28 -5
package/package.json
CHANGED
package/src/cli/cli.js
CHANGED
|
@@ -252,6 +252,11 @@ Main.prototype.setup = async function () {
|
|
|
252
252
|
// tests
|
|
253
253
|
self.projectName = self.firebaseRC.projects.default;
|
|
254
254
|
self.projectUrl = `https://console.firebase.google.com/project/${self.projectName}`;
|
|
255
|
+
|
|
256
|
+
self.bemApiURL = `https://us-central1-${_.get(self.firebaseRC, 'projects.default')}.cloudfunctions.net/bm_api?authenticationToken=${_.get(self.runtimeConfigJSON, 'backend_manager.key')}`;
|
|
257
|
+
// const prepareStatsURL = `https://us-central1-${_.get(self.firebaseRC, 'projects.default')}.cloudfunctions.net/bm_api?authenticationToken=undefined`;
|
|
258
|
+
|
|
259
|
+
|
|
255
260
|
|
|
256
261
|
log(`Id: `, chalk.bold(`${self.projectName}`));
|
|
257
262
|
log(`Url:`, chalk.bold(`${self.projectUrl}`));
|
|
@@ -488,7 +493,7 @@ Main.prototype.setup = async function () {
|
|
|
488
493
|
await self.test('set storage lifecycle policy', async function () {
|
|
489
494
|
const result = await cmd_setStorageLifecycle(self).catch(e => e);
|
|
490
495
|
return !(result instanceof Error);
|
|
491
|
-
},
|
|
496
|
+
}, fix_setStoragePolicy);
|
|
492
497
|
|
|
493
498
|
// Update actual files
|
|
494
499
|
await self.test('update firestore rules file', function () {
|
|
@@ -562,10 +567,7 @@ Main.prototype.setup = async function () {
|
|
|
562
567
|
console.log('\n');
|
|
563
568
|
}
|
|
564
569
|
|
|
565
|
-
|
|
566
|
-
const prepareStatsURL = `https://us-central1-${_.get(self.firebaseRC, 'projects.default')}.cloudfunctions.net/bm_api?authenticationToken=${_.get(self.runtimeConfigJSON, 'backend_manager.key')}`;
|
|
567
|
-
// const prepareStatsURL = `https://us-central1-${_.get(self.firebaseRC, 'projects.default')}.cloudfunctions.net/bm_api?authenticationToken=undefined`;
|
|
568
|
-
const statsFetchResult = await fetch(prepareStatsURL, {
|
|
570
|
+
const statsFetchResult = await fetch(self.bemApiURL, {
|
|
569
571
|
method: 'post',
|
|
570
572
|
timeout: 10000,
|
|
571
573
|
response: 'json',
|
|
@@ -903,6 +905,27 @@ function fix_indexesSync(self) {
|
|
|
903
905
|
});
|
|
904
906
|
};
|
|
905
907
|
|
|
908
|
+
function fix_setStoragePolicy(self) {
|
|
909
|
+
return new Promise(function(resolve, reject) {
|
|
910
|
+
fetch(self.bemApiURL, {
|
|
911
|
+
method: 'post',
|
|
912
|
+
timeout: 10000,
|
|
913
|
+
response: 'json',
|
|
914
|
+
body: {
|
|
915
|
+
command: 'admin:backup',
|
|
916
|
+
},
|
|
917
|
+
})
|
|
918
|
+
.then(json => {
|
|
919
|
+
console.log('Response', json);
|
|
920
|
+
return resolve();
|
|
921
|
+
})
|
|
922
|
+
.catch(e => {
|
|
923
|
+
console.error(chalk.red(`There is no automatic fix. Please run: \n${chalk.bold('firebase deploy && npx bm setup')}`));
|
|
924
|
+
return reject();
|
|
925
|
+
});
|
|
926
|
+
});
|
|
927
|
+
};
|
|
928
|
+
|
|
906
929
|
function fix_firestoreRulesFile(self) {
|
|
907
930
|
return new Promise(function(resolve, reject) {
|
|
908
931
|
const name = 'firestore.rules'
|