show running commit in footer
This commit is contained in:
parent
d44c1156b7
commit
c79cc5797a
2
app.lua
2
app.lua
@ -3,6 +3,7 @@ local app = lapis.Application()
|
|||||||
local constants = require("constants")
|
local constants = require("constants")
|
||||||
local babycode = require("lib.babycode")
|
local babycode = require("lib.babycode")
|
||||||
local html_escape = require("lapis.html").escape
|
local html_escape = require("lapis.html").escape
|
||||||
|
local config = require("lapis.config").get()
|
||||||
|
|
||||||
local db = require("lapis.db")
|
local db = require("lapis.db")
|
||||||
-- sqlite starts without foreign key enforcement
|
-- sqlite starts without foreign key enforcement
|
||||||
@ -17,6 +18,7 @@ local function inject_constants(req)
|
|||||||
req.constants = constants
|
req.constants = constants
|
||||||
math.randomseed(os.time())
|
math.randomseed(os.time())
|
||||||
req.__cachebust = math.random(99999)
|
req.__cachebust = math.random(99999)
|
||||||
|
req.__commit = config.commit
|
||||||
end
|
end
|
||||||
|
|
||||||
local function inject_methods(req)
|
local function inject_methods(req)
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
local config = require("lapis.config")
|
local config = require("lapis.config")
|
||||||
local secrets = require("secrets.secrets")
|
local secrets = require("secrets.secrets")
|
||||||
|
|
||||||
|
local commit = nil
|
||||||
|
local f = io.open(".git/refs/heads/main", "r")
|
||||||
|
if f then
|
||||||
|
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!read commit")
|
||||||
|
commit = f:read(8)
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
config({"development", "production"}, {
|
config({"development", "production"}, {
|
||||||
port = 8080,
|
port = 8080,
|
||||||
server = "nginx",
|
server = "nginx",
|
||||||
@ -11,6 +18,7 @@ config({"development", "production"}, {
|
|||||||
},
|
},
|
||||||
secret = "SUPER SECRET",
|
secret = "SUPER SECRET",
|
||||||
session_name = "porom_session",
|
session_name = "porom_session",
|
||||||
|
commit = commit,
|
||||||
})
|
})
|
||||||
|
|
||||||
config("production", {
|
config("production", {
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
<body>
|
<body>
|
||||||
<% render("views.common.topnav") -%>
|
<% render("views.common.topnav") -%>
|
||||||
<% content_for("inner") %>
|
<% content_for("inner") %>
|
||||||
|
<footer class="darkbg">
|
||||||
|
<span>Porom commit <a href="<%= "https://git.poto.cafe/yagich/porom/commit/" .. __commit %>"><%= __commit %></a>
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
<script src="/static/js/copy-code.js"></script>
|
<script src="/static/js/copy-code.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user