lib/castcaster/engines/nginx_rtmp.rb



module CastCaster
  module Engines
  class NginxRTMP < Base
    IMAGE = CastCaster::IMAGES['nginx']

      def config_file
        File.join(project_dir, 'nginx', 'nginx.conf')
      end

      private

      def generate_config
        FileUtils.mkdir_p(File.join(project_dir, 'nginx'))
        channels = Channel.all
        conf = render_template('nginx-rtmp/nginx.conf.erb',
          hls_dir: '/var/lib/castcaster/hls',
          channels: channels.map(&:to_h)
        )
        File.write(config_file, conf)
      end
    end
  end
end