Skip to content

Commit

Permalink
embed commit hash directly in html instead of separate endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
cemms1 committed Dec 5, 2023
1 parent 6610469 commit 28c9b78
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 5 additions & 1 deletion dotcom-rendering/.prout.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"checkpoints": {
"PROD": {
"url": "https://www.theguardian.com/prout-dcr",
"url": "https://www.theguardian.com/uk",
"overdue": "30M"
},
"CODE": {
"url": "https://m.code.dev-theguardian.com/uk",
"overdue": "30M"
}
}
Expand Down
8 changes: 6 additions & 2 deletions dotcom-rendering/src/server/htmlPageTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { brandBackground, resets } from '@guardian/source-foundations';
import { resets, palette as sourcePalette } from '@guardian/source-foundations';
import he from 'he';
import { ASSET_ORIGIN } from '../lib/assets';
import { escapeData } from '../lib/escapeData';
import { getFontsCss } from '../lib/fonts-css';
import { getHttp3Url } from '../lib/getHttp3Url';
import type { Guardian } from '../model/guardian';
import type { RenderingTarget } from '../types/renderingTarget';
import { GIT_COMMIT_HASH } from './prout';

type BaseProps = {
css: string;
Expand Down Expand Up @@ -196,6 +197,9 @@ https://workforus.theguardian.com/careers/product-engineering/
? weAreHiringMessage
: '<!-- Hello there, HTML enthusiast! -->'
}
<!-- DCR commit hash ${GIT_COMMIT_HASH} -->
<title>${title}</title>
<meta name="description" content="${he.encode(description)}" />
${
Expand All @@ -213,7 +217,7 @@ https://workforus.theguardian.com/careers/product-engineering/
}
${
renderingTarget === 'Web'
? `<meta name="theme-color" content="${brandBackground.primary}" />`
? `<meta name="theme-color" content="${sourcePalette.brand[400]}" />`
: ``
}
<link rel="manifest" href="${ASSET_ORIGIN}static/frontend/manifest.json" />
Expand Down
5 changes: 0 additions & 5 deletions dotcom-rendering/src/server/server.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { getContentFromURLMiddleware } from './lib/get-content-from-url';
import { logger } from './lib/logging';
import { requestLoggerMiddleware } from './lib/logging-middleware';
import { recordError } from './lib/logging-store';
import { GIT_COMMIT_HASH } from './prout';

// Middleware to track route performance using 'response-time' lib
// Usage: app.post('/Article', logRenderTime, renderArticle);
Expand All @@ -55,10 +54,6 @@ export const prodServer = (): void => {
res.status(200).send('OKAY');
});

app.get('/_prout', (req: Request, res: Response) => {
res.status(200).send(GIT_COMMIT_HASH);
});

// if running prod server locally, serve local assets
if (!process.env.GU_PUBLIC) {
app.use('/static/frontend', express.static(__dirname));
Expand Down

0 comments on commit 28c9b78

Please sign in to comment.