mirror of
https://github.com/CompassConnections/Compass.git
synced 2025-12-23 22:18:43 -05:00
Add git info to backend API
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -101,3 +101,5 @@ test-results
|
||||
/.nyc_output/
|
||||
|
||||
**/coverage
|
||||
|
||||
backend/api/metadata.json
|
||||
|
||||
@@ -25,6 +25,19 @@ PROJECT="compass-130ba"
|
||||
SERVICE_NAME="api"
|
||||
|
||||
GIT_REVISION=$(git rev-parse --short HEAD)
|
||||
GIT_COMMIT_DATE=$(git log -1 --format=%ci)
|
||||
GIT_COMMIT_AUTHOR=$(git log -1 --format='%an')
|
||||
|
||||
cat > metadata.json << EOF
|
||||
{
|
||||
"git": {
|
||||
"revision": "${GIT_REVISION}",
|
||||
"commitDate": "${GIT_COMMIT_DATE}",
|
||||
"author": "${GIT_COMMIT_AUTHOR}"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
TIMESTAMP=$(date +"%s")
|
||||
IMAGE_TAG="${TIMESTAMP}-${GIT_REVISION}"
|
||||
IMAGE_URL="${REGION}-docker.pkg.dev/${PROJECT}/builds/${SERVICE_NAME}:${IMAGE_TAG}"
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{}
|
||||
{
|
||||
"git": {
|
||||
"revision": "f734772",
|
||||
"commitDate": "2025-12-04 20:18:25 +0100",
|
||||
"author": "MartinBraquet"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"debug": "nodemon -r tsconfig-paths/register --watch src -e ts --watch ../../common/src --watch ../shared/src --exec \"yarn build && node --inspect-brk src/serve.ts\"",
|
||||
"dist": "yarn dist:clean && yarn dist:copy",
|
||||
"dist:clean": "rm -rf dist && mkdir -p dist/common/lib dist/backend/shared/lib dist/backend/api/lib dist/backend/email/lib",
|
||||
"dist:copy": "rsync -a --delete ../../common/lib/ dist/common/lib && rsync -a --delete ../shared/lib/ dist/backend/shared/lib && rsync -a --delete ../email/lib/ dist/backend/email/lib && rsync -a --delete ./lib/* dist/backend/api/lib && cp ../../yarn.lock dist && cp package.json dist && cp package.json dist/backend/api",
|
||||
"dist:copy": "rsync -a --delete ../../common/lib/ dist/common/lib && rsync -a --delete ../shared/lib/ dist/backend/shared/lib && rsync -a --delete ../email/lib/ dist/backend/email/lib && rsync -a --delete ./lib/* dist/backend/api/lib && cp ../../yarn.lock dist && cp package.json dist && cp package.json dist/backend/api && cp metadata.json dist && cp metadata.json dist/backend/api",
|
||||
"watch": "tsc -w",
|
||||
"verify": "yarn --cwd=../.. verify",
|
||||
"verify:dir": "npx eslint . --max-warnings 0",
|
||||
|
||||
@@ -64,6 +64,7 @@ import {createBookmarkedSearch} from './create-bookmarked-search'
|
||||
import {deleteBookmarkedSearch} from './delete-bookmarked-search'
|
||||
import {OpenAPIV3} from 'openapi-types';
|
||||
import {version as pkgVersion} from './../package.json'
|
||||
import {git} from './../metadata.json'
|
||||
import {z, ZodFirstPartyTypeKind, ZodTypeAny} from "zod";
|
||||
import {getUser} from "api/get-user";
|
||||
import {localSendTestEmail} from "api/test";
|
||||
@@ -280,7 +281,7 @@ const swaggerDocument: OpenAPIV3.Document = {
|
||||
openapi: "3.0.0",
|
||||
info: {
|
||||
title: "Compass API",
|
||||
description: "Compass is a free, open-source platform to help people form deep, meaningful, and lasting connections — whether platonic, romantic, or collaborative. It’s made possible by contributions from the community, including code, ideas, feedback, and donations. Unlike typical apps, Compass prioritizes values, interests, and personality over swipes and ads, giving you full control over who you discover and how you connect.",
|
||||
description: `Compass is a free, open-source platform to help people form deep, meaningful, and lasting connections — whether platonic, romantic, or collaborative. It’s made possible by contributions from the community, including code, ideas, feedback, and donations. Unlike typical apps, Compass prioritizes values, interests, and personality over swipes and ads, giving you full control over who you discover and how you connect.\n Git: ${git.commitDate} (${git.revision}).`,
|
||||
version: pkgVersion,
|
||||
contact: {
|
||||
name: "Compass",
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { APIHandler } from './helpers/endpoint'
|
||||
import {git} from './../metadata.json'
|
||||
|
||||
export const health: APIHandler<'health'> = async (_, auth) => {
|
||||
return {
|
||||
message: 'Server is working.',
|
||||
uid: auth?.uid,
|
||||
git: git,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user