application.rb 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. require_relative '../app/lib/exceptions'
  7. require_relative '../lib/paperclip/lazy_thumbnail'
  8. require_relative '../lib/paperclip/gif_transcoder'
  9. require_relative '../lib/paperclip/video_transcoder'
  10. require_relative '../lib/mastodon/snowflake'
  11. require_relative '../lib/mastodon/version'
  12. require_relative '../lib/devise/ldap_authenticatable'
  13. Dotenv::Railtie.load
  14. Bundler.require(:pam_authentication) if ENV['PAM_ENABLED'] == 'true'
  15. require_relative '../lib/mastodon/redis_config'
  16. module Mastodon
  17. class Application < Rails::Application
  18. # Initialize configuration defaults for originally generated Rails version.
  19. config.load_defaults 5.2
  20. # Settings in config/environments/* take precedence over those specified here.
  21. # Application configuration should go into files in config/initializers
  22. # -- all .rb files in that directory are automatically loaded.
  23. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
  24. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
  25. # config.time_zone = 'Central Time (US & Canada)'
  26. # All translations from config/locales/*.rb,yml are auto loaded.
  27. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
  28. config.i18n.available_locales = [
  29. :en,
  30. :ar,
  31. :ast,
  32. :bg,
  33. :ca,
  34. :co,
  35. :cs,
  36. :cy,
  37. :da,
  38. :de,
  39. :el,
  40. :eo,
  41. :es,
  42. :eu,
  43. :fa,
  44. :fi,
  45. :fr,
  46. :gl,
  47. :he,
  48. :hr,
  49. :hu,
  50. :hy,
  51. :id,
  52. :io,
  53. :it,
  54. :ja,
  55. :ka,
  56. :ko,
  57. :nl,
  58. :no,
  59. :oc,
  60. :pl,
  61. :pt,
  62. :'pt-BR',
  63. :ro,
  64. :ru,
  65. :sk,
  66. :sl,
  67. :sr,
  68. :'sr-Latn',
  69. :sv,
  70. :ta,
  71. :te,
  72. :th,
  73. :tr,
  74. :uk,
  75. :'zh-CN',
  76. :'zh-HK',
  77. :'zh-TW',
  78. ]
  79. config.i18n.default_locale = ENV['DEFAULT_LOCALE']&.to_sym
  80. unless config.i18n.available_locales.include?(config.i18n.default_locale)
  81. config.i18n.default_locale = :en
  82. end
  83. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  84. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  85. config.active_job.queue_adapter = :sidekiq
  86. config.middleware.use Rack::Attack
  87. config.middleware.use Rack::Deflater
  88. config.to_prepare do
  89. Doorkeeper::AuthorizationsController.layout 'modal'
  90. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  91. Doorkeeper::Application.send :include, ApplicationExtension
  92. end
  93. end
  94. end