Compare commits
3 Commits
64941e86f0
...
e1f29b555c
Author | SHA1 | Date | |
---|---|---|---|
e1f29b555c
|
|||
8b69fb745a
|
|||
9c8371e067
|
16
app.rb
16
app.rb
@ -50,6 +50,7 @@ DURATION_PARTS = [
|
|||||||
config = Config.new
|
config = Config.new
|
||||||
|
|
||||||
set :session_secret, config.session_secret.unwrap
|
set :session_secret, config.session_secret.unwrap
|
||||||
|
set :public_folder, __dir__ + "/static"
|
||||||
|
|
||||||
module Sinatra
|
module Sinatra
|
||||||
module RequestHeadersHelper
|
module RequestHeadersHelper
|
||||||
@ -133,7 +134,7 @@ class Health
|
|||||||
include UpDown
|
include UpDown
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@file = "./healthy"
|
@file = "/dev/shm/healthy"
|
||||||
end
|
end
|
||||||
|
|
||||||
def healthy?
|
def healthy?
|
||||||
@ -147,7 +148,7 @@ class Ready
|
|||||||
include UpDown
|
include UpDown
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@file = "./ready"
|
@file = "/dev/shm/ready"
|
||||||
end
|
end
|
||||||
|
|
||||||
def ready?
|
def ready?
|
||||||
@ -160,7 +161,7 @@ class Sleep
|
|||||||
include State
|
include State
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@file = "./sleep"
|
@file = "/dev/shm/sleep"
|
||||||
end
|
end
|
||||||
|
|
||||||
def asleep?
|
def asleep?
|
||||||
@ -499,13 +500,16 @@ get "/bytes/:size" do
|
|||||||
generate_bytes(Integer(n))
|
generate_bytes(Integer(n))
|
||||||
end
|
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_host = ENV.fetch "CAAS_SERVICE_HOST", nil
|
||||||
caas_port = ENV.fetch "CAAS_SERVICE_PORT", nil
|
caas_port = ENV.fetch "CAAS_SERVICE_PORT", nil
|
||||||
url = "http://#{caas_host}:#{caas_port}/"
|
url = "http://#{caas_host}:#{caas_port}/"
|
||||||
unless caas_host && caas_port
|
unless caas_host && caas_port
|
||||||
# fail-safe url
|
url = url("/api/caas")
|
||||||
url = "https://i.imgur.com/epzPw7L.jpeg"
|
|
||||||
end
|
end
|
||||||
tmp_file = Tempfile.open binmode: true do |f|
|
tmp_file = Tempfile.open binmode: true do |f|
|
||||||
# f.chmod 0o644
|
# f.chmod 0o644
|
||||||
|
BIN
static/cat-1.jpg
Normal file
BIN
static/cat-1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
BIN
static/cat-2.jpg
Normal file
BIN
static/cat-2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
BIN
static/cat-3.jpg
Normal file
BIN
static/cat-3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
Reference in New Issue
Block a user