3 Commits

Author SHA1 Message Date
e1f29b555c store status files in /dev/shm
All checks were successful
Gitea Actions Demo / lint (push) Successful in 20s
Gitea Actions Demo / test (push) Successful in 15s
Gitea Actions Demo / release-image (push) Successful in 1m53s
2025-03-12 17:36:14 -05:00
8b69fb745a add an internal fallback URL for CaaS
All checks were successful
Gitea Actions Demo / lint (push) Successful in 27s
Gitea Actions Demo / test (push) Successful in 19s
Gitea Actions Demo / release-image (push) Has been skipped
2025-03-12 17:19:21 -05:00
9c8371e067 change /kitty to /meow 2025-03-12 17:18:41 -05:00
4 changed files with 10 additions and 6 deletions

16
app.rb
View File

@ -50,6 +50,7 @@ DURATION_PARTS = [
config = Config.new
set :session_secret, config.session_secret.unwrap
set :public_folder, __dir__ + "/static"
module Sinatra
module RequestHeadersHelper
@ -133,7 +134,7 @@ class Health
include UpDown
def initialize
@file = "./healthy"
@file = "/dev/shm/healthy"
end
def healthy?
@ -147,7 +148,7 @@ class Ready
include UpDown
def initialize
@file = "./ready"
@file = "/dev/shm/ready"
end
def ready?
@ -160,7 +161,7 @@ class Sleep
include State
def initialize
@file = "./sleep"
@file = "/dev/shm/sleep"
end
def asleep?
@ -499,13 +500,16 @@ get "/bytes/:size" do
generate_bytes(Integer(n))
end
get "/kitty" do
get "/api/caas" do
send_file Dir[__dir__ + "/static/cat*.jpg"].sample
end
get "/meow" do
caas_host = ENV.fetch "CAAS_SERVICE_HOST", nil
caas_port = ENV.fetch "CAAS_SERVICE_PORT", nil
url = "http://#{caas_host}:#{caas_port}/"
unless caas_host && caas_port
# fail-safe url
url = "https://i.imgur.com/epzPw7L.jpeg"
url = url("/api/caas")
end
tmp_file = Tempfile.open binmode: true do |f|
# f.chmod 0o644

BIN
static/cat-1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
static/cat-2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

BIN
static/cat-3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB