Sha256: 4ce7d3a4623f88af92afc20113afc94952f05f76b0345deec298204929172278

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

module BrighterPlanet
  class Deploy
    class Cm1
      include ::Singleton
      include ReadsFromPublicUrl

      RED_IP = '184.73.240.13'

      WANTS = [
        :resque_redis_url,
        :incoming_queue,
        :color,
        :role,
        :environment,
        :log_dir,
        :phase,
        :carrier, # amazon
        :ey_app,  # cm1_edge_blue
        :service
      ]

      def service
        self.class.to_s.demodulize
      end

      def domain
        'carbon.brighterplanet.com'
      end

      def endpoint
        "http://#{domain}"
      end

      def color
        if Deploy.instance.servers.me.service.to_s.underscore == 'cm1'
          (AuthoritativeDnsResolver.getaddress(domain) == RED_IP) ? 'red' : 'blue'
        else
          from_public_url :color
        end
      end

      def method_missing(method_id, *args)
        if args.length == 0 and not block_given?
          from_public_url method_id
        else
          super
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brighter_planet_deploy-0.0.6 lib/brighter_planet_deploy/cm1.rb