Read hostname from /etc/hostname

This commit is contained in:
Josh Holtrop 2026-03-27 23:38:02 -04:00
parent bf4fd38202
commit d206cad0c5
2 changed files with 4 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home Server Status</title>
<title><%= hostname %> status</title>
<style>
body {
background: #0f1117;
@ -115,7 +115,7 @@
<body>
<header>
<h1><span>homelab</span> &middot; status</h1>
<h1><span><%= hostname %></span> &middot; status</h1>
</header>
<div class="card">

View File

@ -7,6 +7,8 @@ ASSETS_DIR = File.join(__dir__, "../assets")
cgi = CGI.new
hostname = File.read("/etc/hostname").strip rescue "localhost"
template = ERB.new(File.read(File.join(ASSETS_DIR, "login.erb")))
cgi.out("type" => "text/html", "charset" => "UTF-8") do