2.2.4 • Published 3 years ago
express-git-self-update v2.2.4
express-git-self-update
Express route to upgrade self from git remote when endpoint is called.
Usage
const Express = require('express');
const SelfUpdate = require('express-git-self-update');
const app = Express();
app.use(Express.json());
const options = {
compareBody: body => body.key === 'SuperSecretExampleKey',
onUpdatedCommand: 'systemctl restart example-program.service'
};
app.post('/webhook/selfupdate', SelfUpdate(options));
Options
Pass options when initializing the middleware to customize it's behavior. Available options:
compareNpmVersion
boolean (default:true
) - Only update when remote package.json version is higher than the local.runNpmInstall
boolean (default:true
) - Automatically runnpm install
after update.compareBody
object => boolean - Function to compare incoming body. Won't update if function returnsfalse
.compareQuery
object => boolean - Function to compare incoming query parameters. Won't update if function returnsfalse
.onUpdate
() => void - Function to call after program has been updated.onUpdateCommand
string - Shell command to execute after program has been updated. (Runs afteronUpdate
.)groupingTime
number (default:0
) - Minimum amount of time in millis to wait after starting a self updating check before allowing a new check. Requests that are sent within this time frame will be grouped together, that is, their response will be the same and returned when the running check finishes.