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.

103 lines
2.7 KiB

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