Commit e7a4d233 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

gitlab-url config

parent 02f4cb52
user: git user: git
gitlab_url: "http://localhost/"
repos_path: "/home/git/repositories" repos_path: "/home/git/repositories"
auth_file: "/home/git/.ssh/authorized_keys" auth_file: "/home/git/.ssh/authorized_keys"
...@@ -8,10 +8,14 @@ class GitlabConfig ...@@ -8,10 +8,14 @@ class GitlabConfig
end end
def repos_path def repos_path
@config['repos_path'] = "/home/git/repositories" @config['repos_path'] ||= "/home/git/repositories"
end end
def auth_file 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
end end
require 'net/http' require 'net/http'
require 'json' require 'json'
require_relative 'gitlab_config'
class GitlabNet class GitlabNet
def allowed?(cmd, repo, key, ref) def allowed?(cmd, repo, key, ref)
project_name = repo.gsub("'", "") project_name = repo.gsub("'", "")
...@@ -23,7 +25,7 @@ class GitlabNet ...@@ -23,7 +25,7 @@ class GitlabNet
protected protected
def host def host
"http://127.0.0.1:3000/api/v3/internal" "#{GitlabConfig.new.gitlab_url}api/v3/internal"
end end
def get(url) def get(url)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment