summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 13:24:41 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 13:24:41 +0200
commite7a4d233c47743acfc788767c93fd7153269be31 (patch)
treefc5196d4b8efd0fb464f24d99f996ef9fd3d155e
parent02f4cb520458ad336e67c259810359ebcdaedb59 (diff)
downloadgitlab-shell-e7a4d233c47743acfc788767c93fd7153269be31.tar.gz
gitlab-url config
-rw-r--r--config.yml.example1
-rw-r--r--lib/gitlab_config.rb8
-rw-r--r--lib/gitlab_net.rb4
3 files changed, 10 insertions, 3 deletions
diff --git a/config.yml.example b/config.yml.example
index 666121d..01dcb68 100644
--- a/config.yml.example
+++ b/config.yml.example
@@ -1,3 +1,4 @@
user: git
+gitlab_url: "http://localhost/"
repos_path: "/home/git/repositories"
auth_file: "/home/git/.ssh/authorized_keys"
diff --git a/lib/gitlab_config.rb b/lib/gitlab_config.rb
index aa20d6e..6e16a13 100644
--- a/lib/gitlab_config.rb
+++ b/lib/gitlab_config.rb
@@ -8,10 +8,14 @@ class GitlabConfig
end
def repos_path
- @config['repos_path'] = "/home/git/repositories"
+ @config['repos_path'] ||= "/home/git/repositories"
end
def auth_file
- @config['auth_file'] = "/home/git/.ssh/authorized_keys"
+ @config['auth_file'] ||= "/home/git/.ssh/authorized_keys"
+ end
+
+ def gitlab_url
+ @config['gitlab_url'] ||= "http://localhost/"
end
end
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index d92d3ab..745394a 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -1,6 +1,8 @@
require 'net/http'
require 'json'
+require_relative 'gitlab_config'
+
class GitlabNet
def allowed?(cmd, repo, key, ref)
project_name = repo.gsub("'", "")
@@ -23,7 +25,7 @@ class GitlabNet
protected
def host
- "http://127.0.0.1:3000/api/v3/internal"
+ "#{GitlabConfig.new.gitlab_url}api/v3/internal"
end
def get(url)