Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-shell
Commits
07d17a8b
Commit
07d17a8b
authored
Mar 23, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23 from regru/http_settings_option
http_settings configuration option added.
parents
601450c3
acdeb0bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
config.yml.example
config.yml.example
+6
-1
lib/gitlab_config.rb
lib/gitlab_config.rb
+4
-0
lib/gitlab_net.rb
lib/gitlab_net.rb
+14
-1
No files found.
config.yml.example
View file @
07d17a8b
# GitLab user. git by default
user: git
# Url to gitlab instance. Used for api calls
# Url to gitlab instance. Used for api calls
. Should be ends with slash.
gitlab_url: "http://localhost/"
http_settings:
# user: someone
# password: somepass
self_signed_cert: false
# Repositories path
repos_path: "/home/git/repositories"
...
...
lib/gitlab_config.rb
View file @
07d17a8b
...
...
@@ -18,4 +18,8 @@ class GitlabConfig
def
gitlab_url
@config
[
'gitlab_url'
]
||=
"http://localhost/"
end
def
http_settings
@config
[
'http_settings'
]
||=
{}
end
end
lib/gitlab_net.rb
View file @
07d17a8b
...
...
@@ -30,15 +30,28 @@ class GitlabNet
protected
def
config
@config
||=
GitlabConfig
.
new
end
def
host
"
#{
GitlabConfig
.
new
.
gitlab_url
}
/api/v3/internal"
"
#{
config
.
gitlab_url
}
/api/v3/internal"
end
def
get
(
url
)
url
=
URI
.
parse
(
url
)
http
=
Net
::
HTTP
.
new
(
url
.
host
,
url
.
port
)
http
.
use_ssl
=
(
url
.
port
==
443
)
if
config
.
http_settings
[
'self_signed_cert'
]
&&
http
.
use_ssl?
http
.
verify_mode
=
OpenSSL
::
SSL
::
VERIFY_NONE
end
request
=
Net
::
HTTP
::
Get
.
new
(
url
.
request_uri
)
if
config
.
http_settings
[
'user'
]
&&
config
.
http_settings
[
'password'
]
request
.
basic_auth
config
.
http_settings
[
'user'
],
config
.
http_settings
[
'password'
]
end
http
.
start
{
|
http
|
http
.
request
(
request
)
}
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment