Can now handle gitea events.
This commit is contained in:
parent
a22c8a4d2a
commit
73d8228c62
13
index.js
13
index.js
|
@ -1,11 +1,13 @@
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import express from 'express'
|
import { exec } from 'child_process'
|
||||||
|
|
||||||
|
import express from 'express'
|
||||||
import njk from 'nunjucks'
|
import njk from 'nunjucks'
|
||||||
|
|
||||||
import { requestHandler } from './libs/requestHandler.js'
|
import { requestHandler } from './libs/requestHandler.js'
|
||||||
import { utils } from './libs/utils/utils.js'
|
import { utils } from './libs/utils/utils.js'
|
||||||
import { nunjacksConfig } from './libs/nunjucksConfig.js'
|
import { nunjacksConfig } from './libs/nunjucksConfig.js'
|
||||||
|
import { generateSiteMap } from './libs/utils/siteMap.js'
|
||||||
|
|
||||||
|
|
||||||
// Load in config
|
// Load in config
|
||||||
|
@ -33,6 +35,15 @@ utils.generate()
|
||||||
// Send all requests to the requestHandler.
|
// Send all requests to the requestHandler.
|
||||||
Server.get('*', (req, res) => requestHandler(req, res, Config))
|
Server.get('*', (req, res) => requestHandler(req, res, Config))
|
||||||
|
|
||||||
|
// Handle events from gitea.
|
||||||
|
Server.post('/gitea/pushEvent', (req, res) => {
|
||||||
|
console.log("Received gitea push event; pulling from gitea and regenerating site map...")
|
||||||
|
exec("git pull")
|
||||||
|
generateSiteMap(Config)
|
||||||
|
res.status(200).send('OK!')
|
||||||
|
console.log("Done!")
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Start the server
|
// Start the server
|
||||||
|
|
Loading…
Reference in New Issue
Block a user