Skip to content

Commit

Permalink
Add /version action.
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed May 7, 2024
1 parent b894fa3 commit fab6045
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/actions/version/index.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Version::Index < BrowserAction
include Auth::AllowGuests

get "/version" do
plain_text "Deployed version: #{College::VERSION}"
end
end
4 changes: 4 additions & 0 deletions src/start_server.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ Signal::INT.trap do
app_server.close
end

module College
VERSION = {{ `git rev-parse --short HEAD`.chomp.stringify }}
end

STDERR.puts "Listening on #{ENV["HOST"]}:#{ENV["PORT"]}"
app_server.listen

0 comments on commit fab6045

Please sign in to comment.