From e4855b82ea72aa180b2dafd9831be4b1143785df Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Thu, 4 Jul 2024 02:01:38 -0500 Subject: [PATCH] Add JSON endpoint for /env --- app.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.rb b/app.rb index a4fff89..b0f0bfe 100644 --- a/app.rb +++ b/app.rb @@ -210,6 +210,12 @@ get "/" do "hello there!\n" end +get "/env", provides: "json" do + return JSON.pretty_generate ENV.sort if params.key? "pretty" + + JSON.generate ENV.sort +end + get "/env" do stream do |out| ENV.sort.each do |k, v|