From fbbb66d5afeda4629e6064a4d0e6418de9531dcb Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Sun, 27 Dec 2020 03:16:57 +0100 Subject: [PATCH] Add option to add tracking to denreg --- registry/src/config.ts | 4 ++++ registry/src/views/_base.tsx | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/registry/src/config.ts b/registry/src/config.ts index bbcfd6b..ca53b51 100644 --- a/registry/src/config.ts +++ b/registry/src/config.ts @@ -14,6 +14,7 @@ const config = ) || {}; if (!config.user) config.user = {}; +if (!config.web) config.web = {}; const env = Deno.env.toObject(); @@ -43,6 +44,9 @@ for (const key in env) { case "S3_REGION": config.s3 = { ...(config.s3 || {}), region: env[key] }; break; + case "WEB_TRACKING": + config.web.tracking = env[key]; + break; } } } diff --git a/registry/src/views/_base.tsx b/registry/src/views/_base.tsx index 1c3ffe0..2d2cfb0 100644 --- a/registry/src/views/_base.tsx +++ b/registry/src/views/_base.tsx @@ -1,5 +1,8 @@ /// import { React } from "../deps.ts"; +import config from "../config.ts"; + +console.log(config); const styles = new TextDecoder().decode( Deno.readFileSync("src/views/styles.css") @@ -105,7 +108,12 @@ export default function Base(p: any, children: any[]) { content="width=device-width,initial-scale=1" /> - {children} + + {config.web.tracking && ( + + )} + {children} + ); }