Commit 0dbb369aced2b445805255b6ce6c003f8bec619a
1 parent
84197407
Exists in
master
and in
4 other branches
Cleanup deprecated configs
Showing
1 changed file
with
24 additions
and
299 deletions
Show diff stats
config/initializers/1_settings.rb
... | ... | @@ -2,272 +2,6 @@ class Settings < Settingslogic |
2 | 2 | source "#{Rails.root}/config/gitlab.yml" |
3 | 3 | |
4 | 4 | class << self |
5 | - # FIXME: Deprecated: remove for 4.1 | |
6 | - def web_protocol | |
7 | - ActiveSupport::Deprecation.warn("Settings.web_protocol is deprecated and will be removed from GitLab 4.1", caller) | |
8 | - gitlab.protocol | |
9 | - rescue Settingslogic::MissingSetting | |
10 | - self.web['protocol'] ||= web.https ? "https" : "http" | |
11 | - end | |
12 | - | |
13 | - # FIXME: Deprecated: remove for 4.1 | |
14 | - def web_host | |
15 | - ActiveSupport::Deprecation.warn("Settings.web_host is deprecated and will be removed from GitLab 4.1", caller) | |
16 | - gitlab.host | |
17 | - rescue Settingslogic::MissingSetting | |
18 | - self.web['host'] ||= 'localhost' | |
19 | - end | |
20 | - | |
21 | - # FIXME: Deprecated: remove for 4.1 | |
22 | - def email_from | |
23 | - ActiveSupport::Deprecation.warn("Settings.email_from is deprecated and will be removed from GitLab 4.1", caller) | |
24 | - gitlab.email_from | |
25 | - rescue Settingslogic::MissingSetting | |
26 | - self.email['from'] ||= ("notify@" + web_host) | |
27 | - end | |
28 | - | |
29 | - # FIXME: Deprecated: remove for 4.1 | |
30 | - def url | |
31 | - ActiveSupport::Deprecation.warn("Settings.url is deprecated and will be removed from GitLab 4.1", caller) | |
32 | - gitlab.url | |
33 | - rescue Settingslogic::MissingSetting | |
34 | - self['url'] ||= build_url | |
35 | - end | |
36 | - | |
37 | - # FIXME: Deprecated: remove for 4.1 | |
38 | - def web_port | |
39 | - ActiveSupport::Deprecation.warn("Settings.web_port is deprecated and will be removed from GitLab 4.1", caller) | |
40 | - gitlab.port.to_i | |
41 | - rescue Settingslogic::MissingSetting | |
42 | - if web.https | |
43 | - web['port'] = 443 | |
44 | - else | |
45 | - web['port'] ||= 80 | |
46 | - end.to_i | |
47 | - end | |
48 | - | |
49 | - # FIXME: Deprecated: remove for 4.1 | |
50 | - def web_custom_port? | |
51 | - ActiveSupport::Deprecation.warn("Settings.web_custom_port? is deprecated and will be removed from GitLab 4.1", caller) | |
52 | - gitlab_on_non_standard_port? | |
53 | - rescue Settingslogic::MissingSetting | |
54 | - ![443, 80].include?(web_port) | |
55 | - end | |
56 | - | |
57 | - # FIXME: Deprecated: remove for 4.1 | |
58 | - def build_url | |
59 | - ActiveSupport::Deprecation.warn("Settings.build_url is deprecated and will be removed from GitLab 4.1", caller) | |
60 | - if web_custom_port? | |
61 | - custom_port = ":#{web_port}" | |
62 | - else | |
63 | - custom_port = nil | |
64 | - end | |
65 | - [ | |
66 | - web_protocol, | |
67 | - "://", | |
68 | - web_host, | |
69 | - custom_port | |
70 | - ].join('') | |
71 | - end | |
72 | - | |
73 | - # FIXME: Deprecated: remove for 4.1 | |
74 | - def ssh_port | |
75 | - ActiveSupport::Deprecation.warn("Settings.ssh_port is deprecated and will be removed from GitLab 4.1", caller) | |
76 | - gitolite.ssh_port | |
77 | - rescue Settingslogic::MissingSetting | |
78 | - git_host['port'] || 22 | |
79 | - end | |
80 | - | |
81 | - # FIXME: Deprecated: remove for 4.1 | |
82 | - def ssh_user | |
83 | - ActiveSupport::Deprecation.warn("Settings.ssh_user is deprecated and will be removed from GitLab 4.1", caller) | |
84 | - gitolite.ssh_user | |
85 | - rescue Settingslogic::MissingSetting | |
86 | - git_host['git_user'] || 'git' | |
87 | - end | |
88 | - | |
89 | - # FIXME: Deprecated: remove for 4.1 | |
90 | - def ssh_host | |
91 | - ActiveSupport::Deprecation.warn("Settings.ssh_host is deprecated and will be removed from GitLab 4.1", caller) | |
92 | - gitolite.ssh_host | |
93 | - rescue Settingslogic::MissingSetting | |
94 | - git_host['host'] || web_host || 'localhost' | |
95 | - end | |
96 | - | |
97 | - # FIXME: Deprecated: remove for 4.1 | |
98 | - def ssh_path | |
99 | - ActiveSupport::Deprecation.warn("Settings.ssh_path is deprecated and will be removed from GitLab 4.1", caller) | |
100 | - gitolite.ssh_path_prefix | |
101 | - rescue Settingslogic::MissingSetting | |
102 | - if ssh_port != 22 | |
103 | - "ssh://#{ssh_user}@#{ssh_host}:#{ssh_port}/" | |
104 | - else | |
105 | - "#{ssh_user}@#{ssh_host}:" | |
106 | - end | |
107 | - end | |
108 | - | |
109 | - # FIXME: Deprecated: remove for 4.1 | |
110 | - def git_base_path | |
111 | - ActiveSupport::Deprecation.warn("Settings.git_base_path is deprecated and will be removed from GitLab 4.1", caller) | |
112 | - gitolite.repos_path | |
113 | - rescue Settingslogic::MissingSetting | |
114 | - git_host['base_path'] || '/home/git/repositories/' | |
115 | - end | |
116 | - | |
117 | - # FIXME: Deprecated: remove for 4.1 | |
118 | - def git_hooks_path | |
119 | - ActiveSupport::Deprecation.warn("Settings.git_hooks_path is deprecated and will be removed from GitLab 4.1", caller) | |
120 | - gitolite.hooks_path | |
121 | - rescue Settingslogic::MissingSetting | |
122 | - git_host['hooks_path'] || '/home/git/share/gitolite/hooks/' | |
123 | - end | |
124 | - | |
125 | - # FIXME: Deprecated: remove for 4.1 | |
126 | - def git_upload_pack | |
127 | - ActiveSupport::Deprecation.warn("Settings.git_upload_pack is deprecated and will be removed from GitLab 4.1", caller) | |
128 | - gitolite.upload_pack | |
129 | - rescue Settingslogic::MissingSetting | |
130 | - if git_host['upload_pack'] != false | |
131 | - true | |
132 | - else | |
133 | - false | |
134 | - end | |
135 | - end | |
136 | - | |
137 | - # FIXME: Deprecated: remove for 4.1 | |
138 | - def git_receive_pack | |
139 | - ActiveSupport::Deprecation.warn("Settings.git_receive_pack is deprecated and will be removed from GitLab 4.1", caller) | |
140 | - gitolite.receive_pack | |
141 | - rescue Settingslogic::MissingSetting | |
142 | - if git_host['receive_pack'] != false | |
143 | - true | |
144 | - else | |
145 | - false | |
146 | - end | |
147 | - end | |
148 | - | |
149 | - # FIXME: Deprecated: remove for 4.1 | |
150 | - def git_bin_path | |
151 | - ActiveSupport::Deprecation.warn("Settings.git_bin_path is deprecated and will be removed from GitLab 4.1", caller) | |
152 | - git.bin_path | |
153 | - rescue Settingslogic::MissingSetting | |
154 | - git['path'] || '/usr/bin/git' | |
155 | - end | |
156 | - | |
157 | - # FIXME: Deprecated: remove for 4.1 | |
158 | - def git_max_size | |
159 | - ActiveSupport::Deprecation.warn("Settings.git_max_size is deprecated and will be removed from GitLab 4.1", caller) | |
160 | - git.max_size | |
161 | - rescue Settingslogic::MissingSetting | |
162 | - git['git_max_size'] || 5242880 # 5.megabytes | |
163 | - end | |
164 | - | |
165 | - # FIXME: Deprecated: remove for 4.1 | |
166 | - def git_timeout | |
167 | - ActiveSupport::Deprecation.warn("Settings.git_timeout is deprecated and will be removed from GitLab 4.1", caller) | |
168 | - git.timeout | |
169 | - rescue Settingslogic::MissingSetting | |
170 | - git['git_timeout'] || 10 | |
171 | - end | |
172 | - | |
173 | - # FIXME: Deprecated: remove for 4.1 | |
174 | - def gitolite_admin_uri | |
175 | - ActiveSupport::Deprecation.warn("Settings.gitolite_admin_uri is deprecated and will be removed from GitLab 4.1", caller) | |
176 | - gitolite.admin_uri | |
177 | - rescue Settingslogic::MissingSetting | |
178 | - git_host['admin_uri'] || 'git@localhost:gitolite-admin' | |
179 | - end | |
180 | - | |
181 | - # FIXME: Deprecated: remove for 4.1 | |
182 | - def gitolite_config_file | |
183 | - ActiveSupport::Deprecation.warn("Settings.gitolite_config_file is deprecated and will be removed from GitLab 4.1", caller) | |
184 | - gitolite.config_file | |
185 | - rescue Settingslogic::MissingSetting | |
186 | - git_host['config_file'] || 'gitolite.conf' | |
187 | - end | |
188 | - | |
189 | - # FIXME: Deprecated: remove for 4.1 | |
190 | - def gitolite_admin_key | |
191 | - ActiveSupport::Deprecation.warn("Settings.gitolite_admin_key is deprecated and will be removed from GitLab 4.1", caller) | |
192 | - gitolite.admin_key | |
193 | - rescue Settingslogic::MissingSetting | |
194 | - git_host['gitolite_admin_key'] || 'gitlab' | |
195 | - end | |
196 | - | |
197 | - # FIXME: Deprecated: remove for 4.1 | |
198 | - def default_projects_limit | |
199 | - ActiveSupport::Deprecation.warn("Settings.default_projects_limit is deprecated and will be removed from GitLab 4.1", caller) | |
200 | - gitlab.default_projects_limit | |
201 | - rescue Settingslogic::MissingSetting | |
202 | - app['default_projects_limit'] || 10 | |
203 | - end | |
204 | - | |
205 | - # FIXME: Deprecated: remove for 4.1 | |
206 | - def backup_path | |
207 | - ActiveSupport::Deprecation.warn("Settings.backup_path is deprecated and will be removed from GitLab 4.1", caller) | |
208 | - backup.path | |
209 | - rescue Settingslogic::MissingSetting | |
210 | - File.expand_path(app['backup_path'] || "backups/", Rails.root) | |
211 | - end | |
212 | - | |
213 | - # FIXME: Deprecated: remove for 4.1 | |
214 | - def backup_keep_time | |
215 | - ActiveSupport::Deprecation.warn("Settings.backup_keep_time is deprecated and will be removed from GitLab 4.1", caller) | |
216 | - backup.keep_time | |
217 | - rescue Settingslogic::MissingSetting | |
218 | - app['backup_keep_time'] || 0 | |
219 | - end | |
220 | - | |
221 | - # FIXME: Deprecated: remove for 4.1 | |
222 | - def ldap_enabled? | |
223 | - ActiveSupport::Deprecation.warn("Settings.ldap_enabled? is deprecated and will be removed from GitLab 4.1", caller) | |
224 | - ldap.enabled | |
225 | - rescue Settingslogic::MissingSetting | |
226 | - false | |
227 | - end | |
228 | - | |
229 | - # FIXME: Deprecated: remove for 4.1 | |
230 | - def omniauth_enabled? | |
231 | - ActiveSupport::Deprecation.warn("Settings.omniauth_enabled? is deprecated and will be removed from GitLab 4.1", caller) | |
232 | - omniauth.enabled | |
233 | - rescue Settingslogic::MissingSetting | |
234 | - false | |
235 | - end | |
236 | - | |
237 | - # FIXME: Deprecated: remove for 4.1 | |
238 | - def omniauth_providers | |
239 | - ActiveSupport::Deprecation.warn("Settings.omniauth_providers is deprecated and will be removed from GitLab 4.1", caller) | |
240 | - omniauth.providers | |
241 | - rescue Settingslogic::MissingSetting | |
242 | - [] | |
243 | - end | |
244 | - | |
245 | - # FIXME: Deprecated: remove for 4.1 | |
246 | - def disable_gravatar? | |
247 | - ActiveSupport::Deprecation.warn("Settings.disable_gravatar? is deprecated and will be removed from GitLab 4.1", caller) | |
248 | - !gravatar.enabled | |
249 | - rescue Settingslogic::MissingSetting | |
250 | - app['disable_gravatar'] || false | |
251 | - end | |
252 | - | |
253 | - # FIXME: Deprecated: remove for 4.1 | |
254 | - def gravatar_url | |
255 | - ActiveSupport::Deprecation.warn("Settings.gravatar_url is deprecated and will be removed from GitLab 4.1", caller) | |
256 | - gravatar.plain_url | |
257 | - rescue Settingslogic::MissingSetting | |
258 | - app['gravatar_url'] || 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | |
259 | - end | |
260 | - | |
261 | - # FIXME: Deprecated: remove for 4.1 | |
262 | - def gravatar_ssl_url | |
263 | - ActiveSupport::Deprecation.warn("Settings.gravatar_ssl_url is deprecated and will be removed from GitLab 4.1", caller) | |
264 | - gravatar.ssl_url | |
265 | - rescue Settingslogic::MissingSetting | |
266 | - app['gravatar_ssl_url'] || 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | |
267 | - end | |
268 | - | |
269 | - | |
270 | - | |
271 | 5 | def gitlab_on_non_standard_port? |
272 | 6 | ![443, 80].include?(gitlab.port.to_i) |
273 | 7 | end |
... | ... | @@ -299,14 +33,6 @@ end |
299 | 33 | |
300 | 34 | |
301 | 35 | # Default settings |
302 | - | |
303 | -# FIXME: Deprecated: remove for 4.1 | |
304 | -# all Settings.web ... | |
305 | -# all Settings.app ... | |
306 | -# all Settings.email ... | |
307 | -# all Settings.git_host ... | |
308 | -Settings['pre_40_config'] ||= Settings['web'].present? | |
309 | - | |
310 | 36 | Settings['ldap'] ||= Settingslogic.new({}) |
311 | 37 | Settings.ldap['enabled'] ||= false |
312 | 38 | |
... | ... | @@ -315,38 +41,37 @@ Settings.omniauth['enabled'] ||= false |
315 | 41 | Settings.omniauth['providers'] ||= [] |
316 | 42 | |
317 | 43 | Settings['gitlab'] ||= Settingslogic.new({}) |
318 | -Settings.gitlab['default_projects_limit'] ||= Settings.pre_40_config ? Settings.default_projects_limit : 10 | |
319 | -Settings.gitlab['host'] ||= Settings.pre_40_config ? Settings.web_host : 'localhost' | |
320 | -Settings.gitlab['https'] ||= Settings.pre_40_config ? Settings.web.https : false | |
44 | +Settings.gitlab['default_projects_limit'] ||= 10 | |
45 | +Settings.gitlab['host'] ||= 'localhost' | |
46 | +Settings.gitlab['https'] ||= false | |
321 | 47 | Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80 |
322 | 48 | Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http" |
323 | -Settings.gitlab['email_from'] ||= Settings.pre_40_config ? Settings.email_from : "gitlab@#{Settings.gitlab.host}" | |
324 | -Settings.gitlab['url'] ||= Settings.pre_40_config ? Settings.url : Settings.send(:build_gitlab_url) | |
49 | +Settings.gitlab['email_from'] ||= "gitlab@#{Settings.gitlab.host}" | |
50 | +Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url) | |
325 | 51 | |
326 | 52 | Settings['gravatar'] ||= Settingslogic.new({}) |
327 | -Settings.gravatar['enabled'] ||= Settings.pre_40_config ? !Settings.disable_gravatar? : true | |
328 | -Settings.gravatar['plain_url'] ||= Settings.pre_40_config ? Settings.gravatar_url : 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | |
329 | -Settings.gravatar['ssl_url'] ||= Settings.pre_40_config ? Settings.gravatar_ssl_url : 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | |
53 | +Settings.gravatar['enabled'] ||= true | |
54 | +Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | |
55 | +Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm' | |
330 | 56 | |
331 | 57 | Settings['gitolite'] ||= Settingslogic.new({}) |
332 | -Settings.gitolite['admin_key'] ||= Settings.pre_40_config ? Settings.gitolite_admin_key : 'gitlab' | |
333 | -Settings.gitolite['admin_uri'] ||= Settings.pre_40_config ? Settings.gitolite_admin_uri : 'git@localhost:gitolite-admin' | |
334 | -Settings.gitolite['config_file'] ||= Settings.pre_40_config ? Settings.gitolite_config_file : 'gitolite.conf' | |
335 | -Settings.gitolite['hooks_path'] ||= Settings.pre_40_config ? Settings.git_hooks_path : '/home/git/share/gitolite/hooks/' | |
336 | -Settings.gitolite['receive_pack'] ||= Settings.pre_40_config ? Settings.git_receive_pack : (Settings.gitolite['receive_pack'] != false) | |
337 | -Settings.gitolite['repos_path'] ||= Settings.pre_40_config ? Settings.git_base_path : '/home/git/repositories/' | |
338 | -Settings.gitolite['upload_pack'] ||= Settings.pre_40_config ? Settings.git_upload_pack : (Settings.gitolite['upload_pack'] != false) | |
339 | -Settings.gitolite['ssh_host'] ||= Settings.pre_40_config ? Settings.ssh_host : (Settings.gitlab.host || 'localhost') | |
340 | -Settings.gitolite['ssh_port'] ||= Settings.pre_40_config ? Settings.ssh_port : 22 | |
341 | -Settings.gitolite['ssh_user'] ||= Settings.pre_40_config ? Settings.ssh_user : 'git' | |
342 | -Settings.gitolite['ssh_path_prefix'] ||= Settings.pre_40_config ? Settings.ssh_path : Settings.send(:build_gitolite_ssh_path_prefix) | |
58 | +Settings.gitolite['admin_key'] ||= 'gitlab' | |
59 | +Settings.gitolite['admin_uri'] ||= 'git@localhost:gitolite-admin' | |
60 | +Settings.gitolite['config_file'] ||= 'gitolite.conf' | |
61 | +Settings.gitolite['hooks_path'] ||= '/home/git/share/gitolite/hooks/' | |
62 | +Settings.gitolite['receive_pack'] ||= (Settings.gitolite['receive_pack'] != false) | |
63 | +Settings.gitolite['repos_path'] ||= '/home/git/repositories/' | |
64 | +Settings.gitolite['upload_pack'] ||= (Settings.gitolite['upload_pack'] != false) | |
65 | +Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost') | |
66 | +Settings.gitolite['ssh_port'] ||= 22 | |
67 | +Settings.gitolite['ssh_user'] ||= 'git' | |
68 | +Settings.gitolite['ssh_path_prefix'] ||= Settings.send(:build_gitolite_ssh_path_prefix) | |
343 | 69 | |
344 | 70 | Settings['backup'] ||= Settingslogic.new({}) |
345 | -Settings.backup['keep_time'] ||= Settings.pre_40_config ? Settings.backup_keep_time : 0 | |
346 | -Settings.backup['path'] = Settings.pre_40_config ? Settings.backup_path : File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) | |
71 | +Settings.backup['keep_time'] ||= 0 | |
72 | +Settings.backup['path'] = File.expand_path(Settings.backup['path'] || "tmp/backups/", Rails.root) | |
347 | 73 | |
348 | 74 | Settings['git'] ||= Settingslogic.new({}) |
349 | -Settings.git['max_size'] ||= Settings.pre_40_config ? Settings.git_max_size : 5242880 # 5.megabytes | |
350 | -Settings.git['bin_path'] ||= Settings.pre_40_config ? Settings.git_bin_path : '/usr/bin/git' | |
351 | -Settings.git['timeout'] ||= Settings.pre_40_config ? Settings.git_timeout : 10 | |
352 | -Settings.git['path'] ||= Settings.git.bin_path # FIXME: Deprecated: remove for 4.1 | |
75 | +Settings.git['max_size'] ||= 5242880 # 5.megabytes | |
76 | +Settings.git['bin_path'] ||= '/usr/bin/git' | |
77 | +Settings.git['timeout'] ||= Settings.git_timeout : 10 | ... | ... |