Files
MatchLiveTv/backend/config/environments/production.rb
Emiliano Frascaro a303a94671 Fix HLS browser in prod e stabilizza broadcast RTMP su iOS.
Il proxy Rails gestisce il redirect MediaMTX su /live/match_* e riscrive le playlist; edge nginx reindirizza /live/ sotto /hls/. Su iOS, SessionBuilder HaishinKit, pipeline mixer corretta e refresh token.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 18:48:29 +02:00

78 lines
2.8 KiB
Ruby

require "active_support/core_ext/integer/time"
Rails.application.configure do
config.enable_reloading = false
config.eager_load = true
config.consider_all_requests_local = false
config.active_storage.service = :local
# Nginx Proxy Manager termina TLS
config.assume_ssl = true
config.force_ssl = true
config.ssl_options = {
redirect: {
exclude: ->(request) {
request.path == "/up" || request.path == "/up/deep" || request.path == "/cable" ||
request.path.start_with?("/hls/") || request.path.match?(%r{\A/live/match_[0-9a-f-]{36}/}i)
}
}
}
config.action_cable.disable_request_forgery_protection = true
if (cable_url = ENV["CABLE_URL"]).present?
config.action_cable.url = cable_url
end
cable_origins = ENV.fetch("CORS_ORIGINS", "*").split(",").map(&:strip)
config.action_cable.allowed_request_origins = cable_origins + [
%r{https?://.*}
]
allowed_hosts = ENV.fetch("ALLOWED_HOSTS", "").split(",").map(&:strip).reject(&:empty?)
config.hosts = allowed_hosts if allowed_hosts.any?
config.host_authorization = {
exclude: ->(request) {
request.path == "/up" || request.path == "/up/deep" || request.path.start_with?("/cable") ||
request.path.start_with?("/hls/") || request.path.match?(%r{\A/live/match_[0-9a-f-]{36}/}i)
}
}
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
config.log_tags = [ :request_id ]
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = {
host: URI.parse(ENV.fetch("APP_PUBLIC_URL", "https://www.matchlivetv.it")).host,
protocol: URI.parse(ENV.fetch("APP_PUBLIC_URL", "https://www.matchlivetv.it")).scheme
}
config.action_mailer.raise_delivery_errors = true
if ENV["SMTP_ADDRESS"].present?
config.action_mailer.delivery_method = :smtp
smtp_port = ENV.fetch("SMTP_PORT", 587).to_i
smtp_ssl = ENV.fetch("SMTP_SSL", smtp_port == 465 ? "true" : "false") == "true"
config.action_mailer.smtp_settings = {
address: ENV["SMTP_ADDRESS"],
port: smtp_port,
user_name: ENV["SMTP_USERNAME"],
password: ENV["SMTP_PASSWORD"],
authentication: ENV.fetch("SMTP_AUTH", "plain"),
ssl: smtp_ssl,
enable_starttls_auto: !smtp_ssl && ENV.fetch("SMTP_STARTTLS", "true") == "true",
open_timeout: ENV.fetch("SMTP_OPEN_TIMEOUT", "15").to_i,
read_timeout: ENV.fetch("SMTP_READ_TIMEOUT", "60").to_i
}
end
config.i18n.fallbacks = true
config.active_support.report_deprecations = false
config.active_record.dump_schema_after_migration = false
config.active_record.attributes_for_inspect = [ :id ]
end