forked from zammad/zammad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.rb
136 lines (118 loc) · 4.45 KB
/
application.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
require_relative 'boot'
require 'rails/all'
require_relative 'issue_2656_workaround_for_rails_issue_33600'
# DO NOT REMOVE THIS LINE - see issue #2037
Bundler.setup
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
# Only load gems for asset compilation if they are needed to avoid
# having unneeded runtime dependencies like NodeJS.
if ARGV.include?('assets:precompile') || Rails.groups.exclude?('production')
Bundler.load.current_dependencies.select do |dep|
require dep.name if dep.groups.include?(:assets)
end
end
module Zammad
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
Rails.autoloaders.each do |autoloader|
autoloader.do_not_eager_load "#{config.root}/lib/core_ext"
autoloader.collapse "#{config.root}/lib/omniauth"
autoloader.inflector.inflect(
'github_database' => 'GithubDatabase',
'otrs' => 'OTRS',
'db' => 'DB',
)
end
# 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.
# Custom directories with classes and modules you want to be autoloadable.
config.add_autoload_paths_to_load_path = false
config.autoload_paths += %W[#{config.root}/lib]
# zeitwerk:check will only check preloaded paths. To make sure that also lib/ gets validated,
# add it to the eager_load_paths only if zeitwerk:check is running.
config.eager_load_paths += %W[#{config.root}/lib] if ARGV[0].eql? 'zeitwerk:check'
config.active_job.queue_adapter = :delayed_job
# Use custom logger to log Thread id next to Process pid
config.log_formatter = ::Logger::Formatter.new
# REST api path
config.api_path = '/api/v1'
# define cache store
if ENV['MEMCACHE_SERVERS'].present?
require 'dalli' # Only load this gem when it is really used.
config.cache_store = [:mem_cache_store, ENV['MEMCACHE_SERVERS'], { expires_in: 7.days }]
else
config.cache_store = [:zammad_file_store, Rails.root.join('tmp', "cache_file_store_#{Rails.env}"), { expires_in: 7.days }]
end
# define websocket session store
config.websocket_session_store = if ENV['REDIS_URL'].present?
:redis
else
:file
end
# Rails 6.1 returns false when the enqueuing is aborted.
config.active_job.return_false_on_aborted_enqueue = true
# default preferences by permission
config.preferences_default_by_permission = {
'ticket.agent' => {
notification_config: {
matrix: {
create: {
criteria: {
owned_by_me: true,
owned_by_nobody: true,
subscribed: true,
no: false,
},
channel: {
email: true,
online: true,
}
},
update: {
criteria: {
owned_by_me: true,
owned_by_nobody: true,
subscribed: true,
no: false,
},
channel: {
email: true,
online: true,
}
},
reminder_reached: {
criteria: {
owned_by_me: true,
owned_by_nobody: false,
subscribed: false,
no: false,
},
channel: {
email: true,
online: true,
}
},
escalation: {
criteria: {
owned_by_me: true,
owned_by_nobody: false,
subscribed: false,
no: false,
},
channel: {
email: true,
online: true,
}
}
}
}
}
}
end
end