Mess around more with analytics tag

This commit is contained in:
Radon Rosborough 2021-11-07 10:29:34 -08:00
parent 18bfc4b0c5
commit b2de596342
4 changed files with 11 additions and 7 deletions

View File

@ -15,7 +15,10 @@ const host = process.env.HOST || "localhost";
const port = parseInt(process.env.PORT || "") || 6119; const port = parseInt(process.env.PORT || "") || 6119;
const tlsPort = parseInt(process.env.TLS_PORT || "") || 6120; const tlsPort = parseInt(process.env.TLS_PORT || "") || 6120;
const useTLS = process.env.TLS ? true : false; const useTLS = process.env.TLS ? true : false;
const analyticsTag = process.env.ANALYTICS_TAG || ""; const analyticsTag = (process.env.ANALYTICS_TAG || "").replace(
/^'(.+)'$/,
"$1"
);
const langs = await langsPromise; const langs = await langsPromise;
const app = express(); const app = express();

View File

@ -264,8 +264,9 @@ enable all the fun CloudFlare options you'd like.
## Set up analytics (optional) ## Set up analytics (optional)
Sign up for Fathom Analytics, enter your domain name, and get a tag Sign up for Fathom Analytics, enter your domain name, and get a tag
for embedding. Set this as `ANALYTICS_TAG` in your `.env` file (don't for embedding. Set this as `ANALYTICS_TAG` in your `.env` file (use
forget the appropriate quoting), and build and roll out a new web AMI. single quoting, as Makefile handling of quotes is a bit nonstandard),
and build and roll out a new web AMI.
## Set up monitoring (optional) ## Set up monitoring (optional)

View File

@ -23,7 +23,7 @@
</script> </script>
<script src="/js/app.js" defer></script> <script src="/js/app.js" defer></script>
<% if (analyticsTag) { %> <% if (analyticsTag) { %>
<%= analyticsTag %> <%- analyticsTag %>
<% } %> <% } %>
</head> </head>
<body> <body>

View File

@ -4,6 +4,9 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Riju</title> <title>Riju</title>
<link rel="stylesheet" href="/css/index.css" /> <link rel="stylesheet" href="/css/index.css" />
<% if (analyticsTag) { %>
<%- analyticsTag %>
<% } %>
</head> </head>
<body> <body>
<h1>Riju: <i>fast</i> online playground for every programming language</h1> <h1>Riju: <i>fast</i> online playground for every programming language</h1>
@ -30,8 +33,5 @@
<% } else { %> <% } else { %>
<i>Riju is loading language configuration...</i> <i>Riju is loading language configuration...</i>
<% } %> <% } %>
<% if (analyticsTag) { %>
<%= analyticsTag %>
<% } %>
</body> </body>
</html> </html>