Skip to content

Instantly share code, notes, and snippets.

@modeverv
Created September 20, 2018 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modeverv/deff4f4974dda0b9d4cc0d65891e2dd8 to your computer and use it in GitHub Desktop.
Save modeverv/deff4f4974dda0b9d4cc0d65891e2dd8 to your computer and use it in GitHub Desktop.
ALLOW_IPS = %w{
192.168.1.1
}
class Acl
def call(env)
if ALLOW_IPS.include? env['REMOTE_ADDR']
[399, {}, []]
else
[403, {'Content-Type' => 'text/plain;charset=utf-8'}, ['Forbidden']]
end
rescue => e
$stderr.puts e
end
end
Acl.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment