Sha256: 3b1be9bd3c9a9c8a8248f75e57f97e4de6955b2f6c67ec28b536ecc518b433dc
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
require 'bundler/setup' require 'securerandom' require 'corpshort' if ENV['RACK_ENV'] == 'production' raise 'Set $SECRET_KEY_BASE' unless ENV['SECRET_KEY_BASE'] end config = { base_url: ENV['CORPSHORT_BASE_URL'], short_base_url: ENV['CORPSHORT_SHORT_BASE_URL'], } case ENV.fetch('CORPSHORT_BACKEND', 'redis') when 'redis' require 'corpshort/backends/redis' config[:backend] = Corpshort::Backends::Redis.new( redis: ENV.key?('REDIS_URL') ? lambda { Redis.new(url: ENV['REDIS_URL']) } : Redis.method(:current), prefix: ENV.fetch('CORPSHORT_REDIS_PREFIX', 'corpshort:'), ) when 'dynamodb' require 'corpshort/backends/dynamodb' config[:backend] = Corpshort::Backends::Dynamodb.new( region: ENV.fetch('CORPSHORT_DYNAMODB_REGION'), table: ENV.fetch('CORPSHORT_DYNAMODB_TABLE'), ) else raise ArgumentError, "Unsupported $CORPSHORT_BACKEND" end use( Rack::Session::Cookie, key: 'corpshortsess', expire_after: 86400, secure: ENV.fetch('CORPSHORT_SECURE_SESSION', ENV['RACK_ENV'] == 'production' ? '1' : nil) == '1', secret: ENV.fetch('SECRET_KEY_BASE', SecureRandom.base64(256)), ) run Corpshort.app(config)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
corpshort-0.2.0 | config.ru |
corpshort-0.1.0 | config.ru |