From c8372cec1c3a68cb6b36fb2987566a0ccef680d3 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..77fb14e 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.to_h if params.key? "pretty" + + JSON.generate ENV.sort.to_h +end + get "/env" do stream do |out| ENV.sort.each do |k, v|