aboutsummaryrefslogtreecommitdiff
path: root/src/mayu.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/mayu.gleam')
-rw-r--r--src/mayu.gleam15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mayu.gleam b/src/mayu.gleam
index b204dc0..bb05b77 100644
--- a/src/mayu.gleam
+++ b/src/mayu.gleam
@@ -1,6 +1,8 @@
import cache
import database
+import envoy
import gleam/erlang/process
+import gleam/string
import mist
import request
import simplifile
@@ -12,14 +14,13 @@ pub fn main() {
let _ = simplifile.create_directory("./data")
let image_cache = cache.load_themes()
- let index_html = case simplifile.read("index.html") {
- Ok(content) -> content
- Error(_) -> {
- wisp.log_error("Failed to read index.html")
-
- ""
- }
+ let version_tag = case envoy.get("MAYU_VERSION") {
+ Ok(version) -> "(v" <> version <> ")"
+ Error(_) -> ""
}
+ let assert Ok(index_html_source) = simplifile.read("index.html")
+ let index_html =
+ string.replace(index_html_source, "{{ MAYU_VERSION }}", version_tag)
use connection <- sqlight.with_connection("./data/count.db")