Module: HealthMode::Authentication
- Defined in:
- lib/authentication.rb
Constant Summary collapse
"127.0.0.1"
- @@public_access =
false
Class Method Summary collapse
- .from_authorized_host?(req) ⇒ Boolean
- .set_authorized_host(hostname) ⇒ Object
- .set_public_access ⇒ Object
Class Method Details
.from_authorized_host?(req) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/authentication.rb', line 16 def self.(req) req.ip == "127.0.0.1" || @@public_access || Socket.getaddrinfo(@@authorized_host, nil)[0][2] == req.ip end |
.set_authorized_host(hostname) ⇒ Object
8 9 10 |
# File 'lib/authentication.rb', line 8 def self.(hostname) @@authorized_host = hostname end |
.set_public_access ⇒ Object
12 13 14 |
# File 'lib/authentication.rb', line 12 def self.set_public_access @@public_access = true end |