Commit 9db7c16a1ef24c009df4aa4e5b4987b97a53e606

Authored by Cyril
1 parent bf753e99

Fix default settings when they are boolean.

error is that ```enabled ||= true``` always evaluates to true.
Change all initialization of bool settings to use the same syntax:
```setting = true if setting.nil?```
Showing 1 changed file with 6 additions and 6 deletions   Show diff stats
config/initializers/1_settings.rb
... ... @@ -35,16 +35,16 @@ end
35 35  
36 36 # Default settings
37 37 Settings['ldap'] ||= Settingslogic.new({})
38   -Settings.ldap['enabled'] ||= false
  38 +Settings.ldap['enabled'] = false if Settings.ldap['enabled'].nil?
39 39  
40 40 Settings['omniauth'] ||= Settingslogic.new({})
41   -Settings.omniauth['enabled'] ||= false
  41 +Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil?
42 42 Settings.omniauth['providers'] ||= []
43 43  
44 44 Settings['gitlab'] ||= Settingslogic.new({})
45 45 Settings.gitlab['default_projects_limit'] ||= 10
46 46 Settings.gitlab['host'] ||= 'localhost'
47   -Settings.gitlab['https'] ||= false
  47 +Settings.gitlab['https'] = false if Settings.gitlab['https'].nil?
48 48 Settings.gitlab['port'] ||= Settings.gitlab.https ? 443 : 80
49 49 Settings.gitlab['relative_url_root'] ||= ''
50 50 Settings.gitlab['protocol'] ||= Settings.gitlab.https ? "https" : "http"
... ... @@ -53,7 +53,7 @@ Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
53 53 Settings.gitlab['user'] ||= 'gitlab'
54 54  
55 55 Settings['gravatar'] ||= Settingslogic.new({})
56   -Settings.gravatar['enabled'] ||= true
  56 +Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil?
57 57 Settings.gravatar['plain_url'] ||= 'http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
58 58 Settings.gravatar['ssl_url'] ||= 'https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm'
59 59  
... ... @@ -62,9 +62,9 @@ Settings.gitolite['admin_key'] ||= 'gitlab'
62 62 Settings.gitolite['admin_uri'] ||= 'git@localhost:gitolite-admin'
63 63 Settings.gitolite['config_file'] ||= 'gitolite.conf'
64 64 Settings.gitolite['hooks_path'] ||= '/home/git/share/gitolite/hooks/'
65   -Settings.gitolite['receive_pack'] ||= (Settings.gitolite['receive_pack'] != false)
  65 +Settings.gitolite['receive_pack'] = true if Settings.gitolite['receive_pack'].nil?
  66 +Settings.gitolite['upload_pack'] = true if Settings.gitolite['upload_pack'].nil?
66 67 Settings.gitolite['repos_path'] ||= '/home/git/repositories/'
67   -Settings.gitolite['upload_pack'] ||= (Settings.gitolite['upload_pack'] != false)
68 68 Settings.gitolite['ssh_host'] ||= (Settings.gitlab.host || 'localhost')
69 69 Settings.gitolite['ssh_port'] ||= 22
70 70 Settings.gitolite['ssh_user'] ||= 'git'
... ...