Sha256: a4d268720e95c6a84d6d8620493cd6229abb1a2be75edee7f17d4ed1ed52c9e3
Contents?: true
Size: 898 Bytes
Versions: 4
Compression:
Stored size: 898 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 rescue ::Service::ConfigurationError # Current service has not been configured yet. end # Returns realm from constant or subdomain. def realm defined?(VIDIBUS_REALM) ? VIDIBUS_REALM : subdomain end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
vidibus-realm-0.1.0 | lib/vidibus/realm/rack.rb |
vidibus-realm-0.0.4 | lib/vidibus/realm/rack.rb |
vidibus-realm-0.0.3 | lib/vidibus/realm/rack.rb |
vidibus-realm-0.0.2 | lib/vidibus/realm/rack.rb |