From 1d543e64300666e2abc5cc8562e6b55458878801 Mon Sep 17 00:00:00 2001 From: randx Date: Mon, 2 Jul 2012 21:59:48 +0300 Subject: [PATCH] Finished with configs --- app/controllers/admin/users_controller.rb | 2 +- config/gitlab.yml.example | 20 +++++++++++++++----- config/initializers/1_settings.rb | 18 +++++++++++++++--- lib/gitlab/gitolite.rb | 2 +- lib/tasks/gitlab/status.rake | 1 - 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 4619cb01..4b123e4f 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -34,7 +34,7 @@ class Admin::UsersController < ApplicationController def new - @admin_user = User.new(:projects_limit => GITLAB_OPTS["default_projects_limit"]) + @admin_user = User.new(:projects_limit => Gitlab.config.default_projects_limit) end def edit diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 679d1cfa..12c28675 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -2,6 +2,10 @@ # Gitlab application config file # # # # # # # # # # # # # # # # # # # +# +# 1. Common settings +# ========================== + # Web application specific settings web: host: localhost @@ -13,11 +17,21 @@ web: email: from: notify@localhost +# Application specific settings +# Like default project limit for user etc +app: + default_projects_limit: 10 + + +# +# 2. Advanced settings: +# ========================== + # Git Hosting configuration git_host: admin_uri: git@localhost:gitolite-admin base_path: /home/git/repositories/ - host: localhost + # host: localhost git_user: git upload_pack: true receive_pack: true @@ -33,7 +47,3 @@ git: git_max_size: 5242880 # 5.megabytes # Git timeout to read commit, in seconds git_timeout: 10 - -# Gitlab settings -gitlab: - default_projects_limit: 10 diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index eccce9cb..a71bfd25 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -33,7 +33,7 @@ class Settings < Settingslogic end def ssh_host - git_host['host'] || 'localhost' + git_host['host'] || web_host || 'localhost' end def ssh_path @@ -49,11 +49,19 @@ class Settings < Settingslogic end def git_upload_pack - git_host['upload_pack'] || true + if git_host['upload_pack'] == false + false + else + true + end end def git_receive_pack - git_host['receive_pack'] || true + if git_host['receive_pack'] == false + false + else + true + end end def git_bin_path @@ -71,5 +79,9 @@ class Settings < Settingslogic def gitolite_admin_uri git['admin_uri'] || 'git@localhost:gitolite-admin' end + + def default_projects_limit + app['default_projects_limit'] || 10 + end end end diff --git a/lib/gitlab/gitolite.rb b/lib/gitlab/gitolite.rb index efb89165..7b80d4a8 100644 --- a/lib/gitlab/gitolite.rb +++ b/lib/gitlab/gitolite.rb @@ -33,7 +33,7 @@ module Gitlab end def configure - Timeout::timeout(20) do + Timeout::timeout(30) do File.open(File.join(Rails.root, 'tmp', "gitlabhq-gitolite.lock"), "w+") do |f| begin f.flock(File::LOCK_EX) diff --git a/lib/tasks/gitlab/status.rake b/lib/tasks/gitlab/status.rake index 7db56574..ac712234 100644 --- a/lib/tasks/gitlab/status.rake +++ b/lib/tasks/gitlab/status.rake @@ -21,7 +21,6 @@ namespace :gitlab do return end - GIT_HOST = YAML.load_file("#{Rails.root}/config/gitlab.yml")["git_host"] print "#{git_base_path}............" if File.exists?(git_base_path) puts "exists".green