2.2.4 • Published 4 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:
compareNpmVersionboolean (default:true) - Only update when remote package.json version is higher than the local.runNpmInstallboolean (default:true) - Automatically runnpm installafter update.compareBodyobject => boolean - Function to compare incoming body. Won't update if function returnsfalse.compareQueryobject => boolean - Function to compare incoming query parameters. Won't update if function returnsfalse.onUpdate() => void - Function to call after program has been updated.onUpdateCommandstring - Shell command to execute after program has been updated. (Runs afteronUpdate.)groupingTimenumber (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.