api/core: update server info
Some checks are pending
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
Run tests / test service functionality (push) Waiting to run
Run tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run tests / check lockfile correctness (push) Waiting to run

- cache server info as string
- serve a list of services & duration limit in server info
This commit is contained in:
wukko 2024-08-23 00:33:52 +06:00
parent 7a557a97c3
commit 70264f3691
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -42,13 +42,16 @@ export const runAPI = (express, app, __dirname) => {
const startTime = new Date();
const startTimestamp = startTime.getTime();
const serverInfo = {
version: version,
const serverInfo = JSON.stringify({
cobalt: {
version: version,
url: env.apiURL,
startTime: `${startTimestamp}`,
durationLimit: env.durationLimit,
services: [...env.enabledServices],
},
git,
cors: env.corsWildcard,
url: env.apiURL,
startTime: `${startTimestamp}`,
}
})
const apiLimiter = rateLimit({
windowMs: env.rateLimitWindow * 1000,
@ -267,7 +270,8 @@ export const runAPI = (express, app, __dirname) => {
})
app.get('/', (_, res) => {
return res.status(200).json(serverInfo);
res.type('json');
res.status(200).send(serverInfo);
})
app.get('/favicon.ico', (req, res) => {