You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.0 KiB

8 years ago
8 years ago
7 years ago
8 years ago
  1. require_relative 'boot'
  2. require 'rails/all'
  3. # Require the gems listed in Gemfile, including any gems
  4. # you've limited to :test, :development, or :production.
  5. Bundler.require(*Rails.groups)
  6. Dotenv::Railtie.load
  7. module Mastodon
  8. class Application < Rails::Application
  9. # Settings in config/environments/* take precedence over those specified here.
  10. # Application configuration should go into files in config/initializers
  11. # -- all .rb files in that directory are automatically loaded.
  12. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  13. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  14. # config.time_zone = 'Central Time (US & Canada)'
  15. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
  16. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  17. # config.i18n.default_locale = :de
  18. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  19. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  20. config.active_job.queue_adapter = :sidekiq
  21. config.middleware.insert_before 0, Rack::Cors do
  22. allow do
  23. origins '*'
  24. resource '/api/*', :headers => :any, :methods => [:post, :put, :delete, :get, :options], credentials: false
  25. resource '/oauth/token', :headers => :any, :methods => [:post], credentials: false
  26. end
  27. end
  28. config.middleware.use Rack::Attack
  29. config.middleware.use Rack::Deflater
  30. config.browserify_rails.source_map_environments += %w[development production]
  31. config.browserify_rails.commandline_options = "--transform [ babelify --presets [ es2015 react ] ] --extension=\".jsx\""
  32. config.to_prepare do
  33. Doorkeeper::AuthorizationsController.layout 'auth'
  34. end
  35. config.action_dispatch.default_headers = {
  36. 'X-Frame-Options' => 'DENY',
  37. 'X-Content-Type-Options' => 'nosniff',
  38. 'X-XSS-Protection' => '1; mode=block'
  39. }
  40. end
  41. end