* VRFS-2104 make sure APP_CONFIG exists in websocket-gateway

This commit is contained in:
Seth Call 2014-08-31 14:45:48 -05:00
parent 1430fb1923
commit c35cfcf0f9
5 changed files with 46 additions and 2 deletions

View File

@ -44,8 +44,10 @@ module JamRuby
# this is basically a dev-time only path of code; we store real artifacts in s3
url = APP_CONFIG.jam_admin_root_url + self.uri.url
else
url = self.uri.url.gsub(APP_CONFIG.aws_fullhost, APP_CONFIG.cloudfront_host)
url = "http://#{APP_CONFIG.cloudfront_host}/#{self[:uri]}"
#url = self.uri.url.gsub(APP_CONFIG.aws_fullhost, APP_CONFIG.cloudfront_host)
end
url
end
end

View File

@ -33,6 +33,7 @@ gem 'sendgrid'
gem 'rb-readline'
gem 'aasm', '3.0.16'
gem 'carrierwave'
gem 'fog'
gem 'devise'
gem 'postgres-copy'
gem 'aws-sdk' #, '1.29.1'

View File

@ -29,6 +29,8 @@ else
Logging.logger.root.level = :info
end
require "#{Dir.pwd}/config/application.rb"
if jamenv == "production"
ENV['NEW_RELIC_LOG'] = '/var/log/websocket-gateway/newrelic_agent.log'

View File

@ -0,0 +1,38 @@
class WebConfig
attr_accessor :config
def initialize()
@config = {}
end
def method_missing(*args)
name = args[0]
value = args[1]
if name[-1] == "="
# strip off '=' and store pure setter name as symbol in hash
@config[name[0..name.length - 2].to_sym] = value
else
@config[name]
end
end
end
APP_CONFIG = config = WebConfig.new
config.storage_type = :fog
# config.storage_type = :file # or :fog, if using AWS
# these only used if storage_type = :fog
config.aws_access_key_id = ENV['AWS_KEY']
config.aws_secret_access_key = ENV['AWS_SECRET']
config.aws_region = 'us-east-1'
config.aws_bucket = 'jamkazam-dev'
config.aws_bucket_public = 'jamkazam-dev-public'
config.aws_cache = '315576000'
config.aws_fullhost = "#{config.aws_bucket_public}.s3.amazonaws.com"
# cloudfront host
config.cloudfront_host = "d34f55ppvvtgi3.cloudfront.net"

View File

@ -684,7 +684,8 @@ module JamWebsockets
end
# if we have OS data, try to grab client update data and let the client have it
update = ArtifactUpdate.find_client_by_os(os) if os
update = ArtifactUpdate.find_client_by_os(os) if client_type == Connection::TYPE_CLIENT && os
client_update = update.update_data if update
login_ack = @message_factory.login_ack(remote_ip,