From 63f6b5bb8b560d5492f1b5dbf5fb9d79567905c2 Mon Sep 17 00:00:00 2001 From: Vagelis Prokopiou Date: Thu, 9 Nov 2017 08:39:34 +0200 Subject: [PATCH 1/2] Adding ip to the config object --- git-server-windows.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/git-server-windows.js b/git-server-windows.js index 4b7f3ff..1a755ea 100644 --- a/git-server-windows.js +++ b/git-server-windows.js @@ -6,6 +6,7 @@ var child_process = require('child_process'); var spawn = child_process.spawn; var zlib = require('zlib') +var ip; var port; var baseURL; var repoDir; @@ -19,6 +20,7 @@ exports.User = function(config) { exports.server = function(config) { var config = config || {}; + ip = config.ip || "127.0.0.1"; port = config.port || 8080; baseURL = config.baseURL || "/git"; repoDir = config.repoDir || "repos"; @@ -35,8 +37,8 @@ exports.server = function(config) { app.post(baseURL + '/:reponame/git-receive-pack', checkAuth, postReceivePack); app.post(baseURL + '/:reponame/git-upload-pack', postUploadPack); - app.listen(port, () => { - console.log('Git Server listening on port ' + port + ' ...'); + app.listen(port, ip, () => { + console.log('Git Server listening on ' + ip + ':' + port); }); }; From ca9e501fc183e3d3d2f63069ee35d07a1ec5374e Mon Sep 17 00:00:00 2001 From: Vagelis Prokopiou Date: Thu, 9 Nov 2017 08:43:51 +0200 Subject: [PATCH 2/2] Adding instructions for ip config parameter --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b1ef5de..06a53d8 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ The git server can be configured using a parameter object on creation: ```js { + ip: '127.0.0.1', port: 8080, baseURL: '/git', repoDir: 'repos', @@ -82,7 +83,10 @@ The git server can be configured using a parameter object on creation: } ``` -By default the server will be started on port 8080, using `/git` as the base URL, `repos` as the subfolder name of your repositories and an empty user list. All of the subfolders of `repos` will be used as repositories. +By default the server will be started on address 127.0.0.1:8080, using `/git` as the base URL, `repos` as the subfolder name of your repositories and an empty user list. All of the subfolders of `repos` will be used as repositories. + +### ip +The `ip` configuration parameter is used to determine the correct ip, in case multiple network adapters (and therefore ips) are associated with the host machine. ### baseURL