application.rb 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. :bn,
  34. :ca,
  35. :co,
  36. :cs,
  37. :cy,
  38. :da,
  39. :de,
  40. :el,
  41. :eo,
  42. :es,
  43. :eu,
  44. :fa,
  45. :fi,
  46. :fr,
  47. :ga,
  48. :gl,
  49. :he,
  50. :hi,
  51. :hr,
  52. :hu,
  53. :hy,
  54. :id,
  55. :io,
  56. :it,
  57. :ja,
  58. :ka,
  59. :kk,
  60. :ko,
  61. :lt,
  62. :lv,
  63. :ms,
  64. :nl,
  65. :no,
  66. :oc,
  67. :pl,
  68. :pt,
  69. :'pt-BR',
  70. :ro,
  71. :ru,
  72. :sk,
  73. :sl,
  74. :sq,
  75. :sr,
  76. :'sr-Latn',
  77. :sv,
  78. :ta,
  79. :te,
  80. :th,
  81. :tr,
  82. :uk,
  83. :'zh-CN',
  84. :'zh-HK',
  85. :'zh-TW',
  86. ]
  87. config.i18n.default_locale = ENV['DEFAULT_LOCALE']&.to_sym
  88. unless config.i18n.available_locales.include?(config.i18n.default_locale)
  89. config.i18n.default_locale = :en
  90. end
  91. # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
  92. # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
  93. config.active_job.queue_adapter = :sidekiq
  94. config.middleware.use Rack::Attack
  95. config.middleware.use Rack::Deflater
  96. config.to_prepare do
  97. Doorkeeper::AuthorizationsController.layout 'modal'
  98. Doorkeeper::AuthorizedApplicationsController.layout 'admin'
  99. Doorkeeper::Application.send :include, ApplicationExtension
  100. end
  101. end
  102. end