2018-11-22 19:58:12 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-22 19:33:08 +00:00
|
|
|
require_relative 'boot'
|
|
|
|
|
2018-11-22 20:00:34 +00:00
|
|
|
require 'rails'
|
2018-11-22 19:33:08 +00:00
|
|
|
# Pick the frameworks you want:
|
2018-11-22 20:00:34 +00:00
|
|
|
require 'active_model/railtie'
|
|
|
|
require 'active_job/railtie'
|
|
|
|
require 'active_record/railtie'
|
|
|
|
require 'active_storage/engine'
|
|
|
|
require 'action_controller/railtie'
|
|
|
|
require 'action_mailer/railtie'
|
|
|
|
require 'action_view/railtie'
|
|
|
|
require 'sprockets/railtie'
|
2018-11-22 19:33:08 +00:00
|
|
|
|
|
|
|
# Require the gems listed in Gemfile, including any gems
|
|
|
|
# you've limited to :test, :development, or :production.
|
|
|
|
Bundler.require(*Rails.groups)
|
|
|
|
|
2019-08-18 04:44:29 +00:00
|
|
|
require 'csv'
|
|
|
|
|
2018-11-22 19:33:08 +00:00
|
|
|
module Partynest
|
|
|
|
class Application < Rails::Application
|
2018-11-29 22:07:24 +00:00
|
|
|
FILTER_PARAMS = %i[
|
|
|
|
api_token
|
2018-12-03 21:03:28 +00:00
|
|
|
confirmation_token
|
2018-11-29 22:07:24 +00:00
|
|
|
password
|
|
|
|
password_confirmation
|
2018-12-03 21:03:28 +00:00
|
|
|
reset_password_token
|
2018-11-29 22:07:24 +00:00
|
|
|
secret
|
2018-12-03 21:03:28 +00:00
|
|
|
unlock_token
|
2018-11-29 22:44:18 +00:00
|
|
|
].freeze
|
2018-11-29 22:07:24 +00:00
|
|
|
|
2019-09-09 21:55:58 +00:00
|
|
|
def restricted?
|
|
|
|
if instance_variable_defined? :@partynest_restricted
|
|
|
|
return @partynest_restricted
|
|
|
|
end
|
|
|
|
|
|
|
|
@partynest_restricted =
|
2019-09-10 00:07:32 +00:00
|
|
|
case ENV['PARTYNEST_RESTRICT']
|
2019-09-09 21:55:58 +00:00
|
|
|
when nil, 'no' then false
|
|
|
|
when 'yes' then true
|
|
|
|
else
|
2019-09-10 00:07:32 +00:00
|
|
|
raise 'Invalid value for ENV "PARTYNEST_RESTRICT"'
|
2019-09-09 21:55:58 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-12-09 03:54:42 +00:00
|
|
|
def settings(name)
|
2019-09-02 17:25:32 +00:00
|
|
|
name = String(name).to_sym
|
|
|
|
raise "Invalid name: #{name.to_s.inspect}" unless name.match?(/\A\w+\z/)
|
|
|
|
|
|
|
|
@partynest_settings ||= {}
|
|
|
|
|
|
|
|
@partynest_settings[name] ||=
|
|
|
|
config_for("settings/#{name}").deep_symbolize_keys.freeze
|
2018-12-09 03:54:42 +00:00
|
|
|
end
|
|
|
|
|
2018-11-22 19:33:08 +00:00
|
|
|
# Initialize configuration defaults for originally generated Rails version.
|
|
|
|
config.load_defaults 5.2
|
|
|
|
|
2019-03-25 03:04:53 +00:00
|
|
|
# Custom directories with classes and modules you want to be autoloadable.
|
|
|
|
config.autoload_paths += [
|
2019-09-01 13:20:42 +00:00
|
|
|
config.root.join('app', 'primitives'),
|
2019-03-25 03:04:53 +00:00
|
|
|
config.root.join('app', 'validators'),
|
2019-09-03 23:26:12 +00:00
|
|
|
config.root.join('lib'),
|
2019-03-25 03:04:53 +00:00
|
|
|
]
|
|
|
|
|
2019-07-19 19:53:02 +00:00
|
|
|
# Use SQL format for database schema
|
|
|
|
config.active_record.schema_format = :sql
|
|
|
|
|
2018-12-07 13:44:51 +00:00
|
|
|
# Use Sidekiq as ActiveJob adapter.
|
|
|
|
config.active_job.queue_adapter = :sidekiq
|
|
|
|
|
2018-11-30 07:55:27 +00:00
|
|
|
config.generators do |g|
|
2018-12-06 20:12:01 +00:00
|
|
|
g.assets false
|
|
|
|
g.helper false
|
2018-12-11 10:59:28 +00:00
|
|
|
g.system_tests nil
|
2018-12-06 20:12:01 +00:00
|
|
|
|
2018-11-30 07:55:27 +00:00
|
|
|
g.factory_bot dir: 'factories'
|
|
|
|
end
|
2018-11-22 19:33:08 +00:00
|
|
|
end
|
|
|
|
end
|