Added offline mode (no remote git sync)
This commit is contained in:
parent
1d237296ca
commit
8af9212837
@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
|
|||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Offline mode (no remote git sync) can now be enabled by setting `git: false` in config.yml
|
||||||
|
|
||||||
## [v1.0-beta.4] - 2017-02-11
|
## [v1.0-beta.4] - 2017-02-11
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -186,6 +186,7 @@ router.get('/*', (req, res, next) => {
|
|||||||
newpath: safePath
|
newpath: safePath
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
res.render('error', {
|
res.render('error', {
|
||||||
message: err.message,
|
message: err.message,
|
||||||
|
17
libs/git.js
17
libs/git.js
@ -51,8 +51,10 @@ module.exports = {
|
|||||||
|
|
||||||
// Define signature
|
// Define signature
|
||||||
|
|
||||||
self._signature.name = appconfig.git.signature.name || 'Wiki'
|
if (appconfig.git) {
|
||||||
self._signature.email = appconfig.git.signature.email || 'user@example.com'
|
self._signature.name = appconfig.git.signature.name || 'Wiki'
|
||||||
|
self._signature.email = appconfig.git.signature.email || 'user@example.com'
|
||||||
|
}
|
||||||
|
|
||||||
return self
|
return self
|
||||||
},
|
},
|
||||||
@ -86,6 +88,11 @@ module.exports = {
|
|||||||
self._repo.exists = false
|
self._repo.exists = false
|
||||||
})
|
})
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
if (appconfig.git === false) {
|
||||||
|
winston.info('[' + PROCNAME + '][GIT] Remote syncing is disabled. Not recommended!')
|
||||||
|
return Promise.resolve(true)
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize remote
|
// Initialize remote
|
||||||
|
|
||||||
let urlObj = URL.parse(appconfig.git.url)
|
let urlObj = URL.parse(appconfig.git.url)
|
||||||
@ -144,6 +151,12 @@ module.exports = {
|
|||||||
resync () {
|
resync () {
|
||||||
let self = this
|
let self = this
|
||||||
|
|
||||||
|
// Is git remote disabled?
|
||||||
|
|
||||||
|
if (appconfig.git === false) {
|
||||||
|
return Promise.resolve(true)
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch
|
// Fetch
|
||||||
|
|
||||||
winston.info('[' + PROCNAME + '][GIT] Performing pull from remote repository...')
|
winston.info('[' + PROCNAME + '][GIT] Performing pull from remote repository...')
|
||||||
|
Loading…
Reference in New Issue
Block a user