]> cat aescling's git repositories - mastodon.git/blob - config/application.rb
Add headings to the security settings page (#6661)
[mastodon.git] / config / application.rb
1 require_relative 'boot'
2
3 require 'rails/all'
4
5 # Require the gems listed in Gemfile, including any gems
6 # you've limited to :test, :development, or :production.
7 Bundler.require(*Rails.groups)
8
9 require_relative '../app/lib/exceptions'
10 require_relative '../lib/paperclip/lazy_thumbnail'
11 require_relative '../lib/paperclip/gif_transcoder'
12 require_relative '../lib/paperclip/video_transcoder'
13 require_relative '../lib/mastodon/snowflake'
14 require_relative '../lib/mastodon/version'
15 require_relative '../lib/devise/ldap_authenticatable'
16
17 Dotenv::Railtie.load
18
19 require_relative '../lib/mastodon/redis_config'
20
21 module Mastodon
22 class Application < Rails::Application
23 # Initialize configuration defaults for originally generated Rails version.
24 config.load_defaults 5.1
25
26 # Settings in config/environments/* take precedence over those specified here.
27 # Application configuration should go into files in config/initializers
28 # -- all .rb files in that directory are automatically loaded.
29
30 # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
31 # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
32 # config.time_zone = 'Central Time (US & Canada)'
33
34 # All translations from config/locales/*.rb,yml are auto loaded.
35 # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36 config.i18n.available_locales = [
37 :en,
38 :ar,
39 :bg,
40 :ca,
41 :de,
42 :eo,
43 :es,
44 :fa,
45 :fi,
46 :fr,
47 :gl,
48 :he,
49 :hr,
50 :hu,
51 :hy,
52 :id,
53 :io,
54 :it,
55 :ja,
56 :ko,
57 :nl,
58 :no,
59 :oc,
60 :pl,
61 :pt,
62 :'pt-BR',
63 :ru,
64 :sk,
65 :sr,
66 :'sr-Latn',
67 :sv,
68 :th,
69 :tr,
70 :uk,
71 :'zh-CN',
72 :'zh-HK',
73 :'zh-TW',
74 ]
75
76 config.i18n.default_locale = ENV['DEFAULT_LOCALE']&.to_sym
77 if config.i18n.available_locales.include?(config.i18n.default_locale)
78 config.i18n.fallbacks = [:en]
79 else
80 config.i18n.default_locale = :en
81 end
82
83 # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
84 # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
85
86 config.active_job.queue_adapter = :sidekiq
87
88 config.middleware.insert_before 0, Rack::Cors do
89 allow do
90 origins '*'
91 resource '/@:username', headers: :any, methods: [:get], credentials: false
92 resource '/api/*', headers: :any, methods: [:post, :put, :delete, :get, :patch, :options], credentials: false, expose: ['Link', 'X-RateLimit-Reset', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'X-Request-Id']
93 resource '/oauth/token', headers: :any, methods: [:post], credentials: false
94 end
95 end
96
97 config.middleware.use Rack::Attack
98 config.middleware.use Rack::Deflater
99
100 config.to_prepare do
101 Doorkeeper::AuthorizationsController.layout 'modal'
102 Doorkeeper::AuthorizedApplicationsController.layout 'admin'
103 Doorkeeper::Application.send :include, ApplicationExtension
104 end
105 end
106 end
This page took 0.097224 seconds and 4 git commands to generate.