Add option to add tracking to denreg
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Fabian Stamm 2020-12-27 03:16:57 +01:00
parent df1f4965ad
commit fbbb66d5af
2 changed files with 13 additions and 1 deletions

View File

@ -14,6 +14,7 @@ const config =
) || {}; ) || {};
if (!config.user) config.user = {}; if (!config.user) config.user = {};
if (!config.web) config.web = {};
const env = Deno.env.toObject(); const env = Deno.env.toObject();
@ -43,6 +44,9 @@ for (const key in env) {
case "S3_REGION": case "S3_REGION":
config.s3 = { ...(config.s3 || {}), region: env[key] }; config.s3 = { ...(config.s3 || {}), region: env[key] };
break; break;
case "WEB_TRACKING":
config.web.tracking = env[key];
break;
} }
} }
} }

View File

@ -1,5 +1,8 @@
/// <reference path="../types/jsx.d.ts" /> /// <reference path="../types/jsx.d.ts" />
import { React } from "../deps.ts"; import { React } from "../deps.ts";
import config from "../config.ts";
console.log(config);
const styles = new TextDecoder().decode( const styles = new TextDecoder().decode(
Deno.readFileSync("src/views/styles.css") 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" content="width=device-width,initial-scale=1"
/> />
</head> </head>
<body class="site">{children}</body> <body class="site">
{config.web.tracking && (
<tracking innerHTML={config.web.tracking}></tracking>
)}
{children}
</body>
</html> </html>
); );
} }