txtdot/templates/configuration.ejs
Artemy Egorov 6e9e9a6cc6
Plugins config (#147)
* refactor: rename configs

* refactor: create plugin config

* refactor: universal config

* fix: engine plugins default list
2024-04-27 22:15:19 +03:00

55 lines
1.6 KiB
Plaintext

<%
// hide private properties from config
const to_hide = ["host", "port"];
function replacer(key,value) {
if (to_hide.includes(key)) return undefined;
else return value;
}
function to_pretty(obj) {
return JSON.stringify(obj, replacer, 2).replace(/[\[\]{}"]/g, "").replace(/,/g, "");
}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="<%= config.package.description %>">
<title>txt. configuration</title>
<link rel="stylesheet" href="/static/common.css">
<link rel="stylesheet" href="/static/configuration.css">
</head>
<body>
<main>
<header>
<h1>txt<span class="dot">.</span></h1>
<div class="menu">
<a class="button secondary" href="/">Home</a>
</div>
<p><%= config.package.description %></p>
</header>
<div class="configuration">
<h2>Configuration</h2>
<pre> version: <%= config.package.version %><%= to_pretty(config.env) %></pre>
<h2>Available engines</h2>
<ol>
<%
for (const engine of engines) {
%><li><%= engine.name %>: <%= engine.description %></li><%
}
%>
</ol>
<h2>Available routes</h2>
<%
for (const route of config.dyn.routes) {
%><a class="button secondary" href="<%= route %>"><%= route %></a><%
}
%>
</div>
</main>
</body>
</html>