forgeplus/config/application.rb

51 lines
1.7 KiB
Ruby
Raw Normal View History

2022-07-19 17:48:32 +08:00
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
2022-07-19 17:56:06 +08:00
module Gitlink
2022-07-19 17:48:32 +08:00
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
#
#
2022-07-19 17:56:06 +08:00
# config.gitlink = config_for(:configuration)
2022-07-19 17:48:32 +08:00
2022-07-19 17:56:06 +08:00
# Custom directories with classes and modules you want to be autoloadable.
2022-07-19 17:48:32 +08:00
2022-07-19 17:56:06 +08:00
config.active_record.default_timezone = :utc
2022-07-19 17:48:32 +08:00
config.time_zone = 'Beijing'
# I18n
config.i18n.default_locale = 'zh-CN'
config.i18n.load_path += Dir[Rails.root.join('config/locales', '**', '*.yml').to_s]
# job
config.active_job.queue_adapter = :sidekiq
2022-07-19 17:56:06 +08:00
# disable actioncable development nend true
# config.action_cable.disable_request_forgery_protection = true
2022-07-19 17:48:32 +08:00
config.middleware.use OmniAuth::Builder do
provider :cas, url: 'https://urp.tfswufe.edu.cn/cas'
end
config.middleware.insert_before 0, Rack::Cors do
allow do
2022-07-19 17:58:52 +08:00
# origins '*'
2022-07-19 18:05:53 +08:00
origins /http:\/\/localhost(:\d+)?\z/, /^(http|https):\/\/(.*(gitlink.org.cn))$/, /^(http|https):\/\/(.*(trustie.net))$/
2022-07-19 17:48:32 +08:00
# location of your api
2022-07-21 10:43:58 +08:00
resource '/*', :headers => :any, :methods => [:get, :post, :delete, :options, :put, :patch], credentials: true
2022-07-19 17:48:32 +08:00
end
end
end
end