lib/lamby/debug.rb in lamby-2.1.0 vs lib/lamby/debug.rb in lamby-2.2.0
- old
+ new
@@ -4,11 +4,11 @@
extend self
def on?(event)
params = event['multiValueQueryStringParameters'] || event['queryStringParameters']
- (Rails.env.development? || ENV['LAMBY_DEBUG']) && params && params['debug'] == '1'
+ (development? || ENV['LAMBY_DEBUG']) && params && params['debug'] == '1'
end
def call(event, context, env)
[ 200, { 'Content-Type' => 'text/html' }, [body(event, context, env)] ]
end
@@ -38,9 +38,16 @@
#{sam_local? ? JSON.pretty_generate(ENV.to_h) : 'N/A'}
</pre>
</body>
</html>
HTML
+ end
+
+ def development?
+ ENV
+ .slice('RACK_ENV', 'RAILS_ENV')
+ .values
+ .any? { |v| v.to_s.casecmp('development').zero? }
end
end
end