Skip to content

Commit

Permalink
create force backup mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrum committed Jan 25, 2023
1 parent bc56503 commit 155be33
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions pages/[...identifier].js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ export async function getServerSideProps(context) {

if(query.pdsOnly === 'true') { props.pdsOnly = true }
if(query.mockup === 'true') { props.mockup = true }

if(!!query.internal_enable_backup_mode) {
console.log('Forcing backup mode 🚨🚨🚨')
runtime.setForcedBackupMode(true)
}

if(runtime.backupMode) {
props.backupMode = true

Expand Down
11 changes: 9 additions & 2 deletions services/runtime.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
let _backupMode = false
let _forcedBackupMode = false

const setBackupMode = (value) => {
_backupMode = !!value
if(_forcedBackupMode) { console.log('Forced backup mode is active, ignoring request to set backup mode to ' + value) }
}

const setForcedBackupMode = (value) => {
_forcedBackupMode = !!value
}

export default {
get backupMode() { return _backupMode },
setBackupMode }
get backupMode() { return _backupMode || _forcedBackupMode },
setBackupMode,
setForcedBackupMode }

0 comments on commit 155be33

Please sign in to comment.