summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_config.rb8
-rw-r--r--lib/gitlab_net.rb4
2 files changed, 9 insertions, 3 deletions
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)