diff --git a/pkg/config/config.go b/pkg/config/config.go
index 0e85b5abb5231e21caf6a1a3db5c6168709cc10b..6ac6d0560dddf90e88fdce766d2a0261d5a4ab2c 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -227,7 +227,7 @@ func defaultConfiguration() *configuration {
return &configuration{
Scan: defaultScan(),
RootReadme: "",
- ListenAddr: "http//0.0.0.0:8080",
+ ListenAddr: defaultAddr(),
Repositories: make([]*GitRepositoryConfiguration, 0),
}
}
@@ -237,7 +237,10 @@ return &scan{
Public: false,
Path: "",
}
+}
+func defaultAddr() string {
+ return "tcp://localhost:8080"
}
func defaultRepisotryConfiguration(path string) *GitRepositoryConfiguration {
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go
index 9109ecb47e242baa141860f478524b2299f33d8a..2d779c53ce9aee562d0e7d57e354b7470aa534de 100644
--- a/pkg/config/config_test.go
+++ b/pkg/config/config_test.go
@@ -22,6 +22,7 @@ Scan: &scan{
Public: false,
Path: "/srv/git",
},
+ ListenAddr: defaultAddr(),
Repositories: []*GitRepositoryConfiguration{},
},
},
@@ -36,6 +37,7 @@ Scan: &scan{
Public: true,
Path: "/srv/git",
},
+ ListenAddr: defaultAddr(),
Repositories: []*GitRepositoryConfiguration{},
},
},
@@ -43,7 +45,8 @@ {
name: "minimal repository",
config: `repository /srv/git/cerrado.git`,
expectedConfig: &configuration{
- Scan: defaultScan(),
+ Scan: defaultScan(),
+ ListenAddr: defaultAddr(),
Repositories: []*GitRepositoryConfiguration{
{
Name: "cerrado.git",
@@ -63,7 +66,8 @@ description "Single person forge"
public true
}`,
expectedConfig: &configuration{
- Scan: defaultScan(),
+ Scan: defaultScan(),
+ ListenAddr: defaultAddr(),
Repositories: []*GitRepositoryConfiguration{
{
Name: "cerrado",
@@ -75,8 +79,28 @@ },
},
},
{
+ name: "minimal listen",
+ config: ``,
+ expectedConfig: &configuration{
+ Scan: defaultScan(),
+ ListenAddr: defaultAddr(),
+ Repositories: []*GitRepositoryConfiguration{},
+ },
+ },
+ {
+ name: "complete listen",
+ config: `listen-addr unix://var/run/cerrado/cerrado.sock`,
+ expectedConfig: &configuration{
+ Scan: defaultScan(),
+ ListenAddr: "unix://var/run/cerrado/cerrado.sock",
+ Repositories: []*GitRepositoryConfiguration{},
+ },
+ },
+ {
name: "complete",
config: `
+listen-addr unix://var/run/cerrado/cerrado.sock
+
scan "/srv/git" {
public true
}
@@ -93,6 +117,7 @@ Scan: &scan{
Public: true,
Path: "/srv/git",
},
+ ListenAddr: "unix://var/run/cerrado/cerrado.sock",
Repositories: []*GitRepositoryConfiguration{
{
Name: "linux.git",