Created
September 20, 2018 05:44
-
-
Save modeverv/deff4f4974dda0b9d4cc0d65891e2dd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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