Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save katrinafyi/e5a6b6d8bed540af46bba8c3cc3d9d08 to your computer and use it in GitHub Desktop.
Save katrinafyi/e5a6b6d8bed540af46bba8c3cc3d9d08 to your computer and use it in GitHub Desktop.
patch files for UQ PAC's build of godbolt (https://github.com/ailrst/compiler-explorer)
From d6bac7610789c172ccc2e59169f2892f8adff901 Mon Sep 17 00:00:00 2001
From: rina <k@rina.fyi>
Date: Fri, 13 Oct 2023 18:48:01 +1000
Subject: [PATCH] support environment variables in properties.
---
lib/properties.ts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/properties.ts b/lib/properties.ts
index 0a8ee17b..71f2a0cc 100644
--- a/lib/properties.ts
+++ b/lib/properties.ts
@@ -66,6 +66,9 @@ export function get(base: string, property: string, defaultValue?: unknown): unk
source = elem;
}
}
+ if (typeof result === 'string') {
+ result = result.replaceAll(/\$\{([^}]+)\}/g, (prev, name) => process.env[name] ?? prev);
+ }
debug(`${base}.${property}: returning ${result} (from ${source})`);
return result;
}
--
2.42.0
From be11516c93c2db55b4f4a83c758bdf4205131e92 Mon Sep 17 00:00:00 2001
From: rina <k@rina.fyi>
Date: Fri, 13 Oct 2023 19:23:20 +1000
Subject: [PATCH] remove Sentry logging.
forcibly disables the sentry logging to avoid its runtime dependency.
---
lib/handlers/compile.ts | 2 --
lib/sentry.ts | 9 ++++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/handlers/compile.ts b/lib/handlers/compile.ts
index 9350a987..258f5f9a 100644
--- a/lib/handlers/compile.ts
+++ b/lib/handlers/compile.ts
@@ -24,7 +24,6 @@
import path from 'path';
-import * as Sentry from '@sentry/node';
import express from 'express';
import fs from 'fs-extra';
import Server from 'http-proxy';
@@ -188,7 +187,6 @@ export class CompileHandler {
try {
json = JSON.stringify(bodyData);
} catch (e) {}
- Sentry.captureMessage(`Unknown proxy bodyData: ${typeof bodyData} ${json}`);
proxyReq.write('Proxy error');
}
});
diff --git a/lib/sentry.ts b/lib/sentry.ts
index ad2f1544..61418347 100644
--- a/lib/sentry.ts
+++ b/lib/sentry.ts
@@ -26,8 +26,6 @@ import {logger} from './logger.js';
import {PropertyGetter} from './properties.interfaces.js';
import {parse} from '../shared/stacktrace.js';
-import * as Sentry from '@sentry/node';
-
function shouldRedactRequestData(data: string) {
try {
const parsed = JSON.parse(data);
@@ -37,6 +35,8 @@ function shouldRedactRequestData(data: string) {
}
}
+let Sentry: any;
+
export function SetupSentry(
sentryDsn: string,
ceProps: PropertyGetter,
@@ -44,6 +44,8 @@ export function SetupSentry(
gitReleaseName: string | undefined,
defArgs: any,
) {
+ logger.info('Sentry is disabled in the Nix build.');
+ return;
if (!sentryDsn) {
logger.info('Not configuring sentry');
return;
@@ -63,7 +65,8 @@ export function SetupSentry(
logger.info(`Configured with Sentry endpoint ${sentryDsn}`);
}
-export function SentryCapture(value: unknown, context?: string) {
+export function SentryCapture(value: any, context?: string) {
+ return;
if (value instanceof Error) {
if (context) {
value.message += `\nSentryCapture Context: ${context}`;
--
2.42.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment