Sha256: 9e9598cd618fc05e46cf11f3f9a2292439a6345b12f4032aaedea65e3118ac34
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
require "vidibus-service" module Vidibus module Realm class Rack attr_reader :app, :env def initialize(app) @app = app end def call(env) @env = env env[:realm] = realm app.call(env) end protected # Returns current subdomain which is, for now, the realm uuid itself. # The hostname must match the current service's domain because it may # contain several subdomains as well which are not suitable for # identifying the current realm. def subdomain env["SERVER_NAME"].match(/(.+)\.#{::Service.this.domain}/) $1 end # Returns realm from constant or subdomain. def realm defined?(VIDIBUS_REALM) ? VIDIBUS_REALM : subdomain end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vidibus-realm-0.0.1 | lib/vidibus/realm/rack.rb |