Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
e12628ce
Commit
e12628ce
authored
Jul 30, 2015
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Unix domain socket support
parent
b67e2dd2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
main.go
main.go
+13
-0
No files found.
main.go
View file @
e12628ce
...
@@ -49,6 +49,7 @@ var repoRoot string
...
@@ -49,6 +49,7 @@ var repoRoot string
var
printVersion
=
flag
.
Bool
(
"version"
,
false
,
"Print version and exit"
)
var
printVersion
=
flag
.
Bool
(
"version"
,
false
,
"Print version and exit"
)
var
listenAddr
=
flag
.
String
(
"listenAddr"
,
"localhost:8181"
,
"Listen address for HTTP server"
)
var
listenAddr
=
flag
.
String
(
"listenAddr"
,
"localhost:8181"
,
"Listen address for HTTP server"
)
var
listenNetwork
=
flag
.
String
(
"listenNetwork"
,
"tcp"
,
"Listen 'network' (protocol)"
)
var
listenNetwork
=
flag
.
String
(
"listenNetwork"
,
"tcp"
,
"Listen 'network' (protocol)"
)
var
listenUmask
=
flag
.
Int
(
"listenUmask"
,
022
,
"Umask for Unix socket, default: 022"
)
var
authBackend
=
flag
.
String
(
"authBackend"
,
"http://localhost:8080"
,
"Authentication/authorization backend"
)
var
authBackend
=
flag
.
String
(
"authBackend"
,
"http://localhost:8080"
,
"Authentication/authorization backend"
)
var
gitServices
=
[
...
]
gitService
{
var
gitServices
=
[
...
]
gitService
{
...
@@ -77,10 +78,22 @@ func main() {
...
@@ -77,10 +78,22 @@ func main() {
log
.
Printf
(
"repoRoot: %s"
,
repoRoot
)
log
.
Printf
(
"repoRoot: %s"
,
repoRoot
)
http
.
HandleFunc
(
"/"
,
gitHandler
)
http
.
HandleFunc
(
"/"
,
gitHandler
)
// Good housekeeping for Unix sockets: unlink before binding
if
*
listenNetwork
==
"unix"
{
if
err
:=
os
.
Remove
(
*
listenAddr
);
err
!=
nil
{
log
.
Fatal
(
err
)
}
}
// Change the umask only around net.Listen()
oldUmask
:=
syscall
.
Umask
(
*
listenUmask
)
listener
,
err
:=
net
.
Listen
(
*
listenNetwork
,
*
listenAddr
)
listener
,
err
:=
net
.
Listen
(
*
listenNetwork
,
*
listenAddr
)
syscall
.
Umask
(
oldUmask
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatal
(
err
)
log
.
Fatal
(
err
)
}
}
log
.
Fatal
(
http
.
Serve
(
listener
,
nil
))
log
.
Fatal
(
http
.
Serve
(
listener
,
nil
))
}
}
...
...
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