App can now go into maintenance mode locking out routing

This commit is contained in:
Stefan Zermatten
2021-12-29 14:25:01 +02:00
parent 2cf19d1ee5
commit ed1873babe
6 changed files with 109 additions and 30 deletions

View File

@@ -1,3 +1,19 @@
const MAINTENANCE_MODE = Meteor.settings?.public?.maintenanceMode || false;
import { Migrations } from 'meteor/percolate:migrations';
import SCHEMA_VERSION from '/imports/constants/SCHEMA_VERSION.js';
if (Meteor.isServer){
Meteor.startup(()=>{
const dbVersion = Migrations.getVersion();
if (
!Meteor.settings.public.maintenanceMode &&
SCHEMA_VERSION !== dbVersion
){
Meteor.settings.public.maintenanceMode = {
reason: 'App data needs to be migrated to the latest version'
};
}
});
}
const MAINTENANCE_MODE = Meteor.settings.public.maintenanceMode;
export default MAINTENANCE_MODE;