2a1313de9d3955651f73eb281583dbb5aeaacae9

Author
Christian Rocha <christian@rocha.is>
Committer
Toby Padilla <tobypadilla@gmail.com>
Date

Message

Clarify that host 'n port settings in config are for display purposes

Diff

 1diff --git a/README.md b/README.md
 2index 2be9127202a4cbfdea591851240ee0b04107d34d..088690c10c6d13d2c796e805b2ff628178abc877 100644
 3--- a/README.md
 4+++ b/README.md
 5@@ -67,7 +67,9 @@ The Soft Serve configuration is simple and straightforward:
 6 # The name of the server to show in the TUI.
 7 name: Soft Serve
 8 
 9-# The host and port to listen on. Defaults to 0.0.0.0:23231.
10+# The host and port to display in the TUI. You may want to change this if your
11+# server is accessible from a different host and/or port that what it's
12+# actually listening on (for example, if it's behind a reverse proxy).
13 host: localhost
14 port: 23231
15 
16diff --git a/internal/config/defaults.go b/internal/config/defaults.go
17index f8af40772c7d49b877b31cb283337b78e50cc50f..22cf1235c6ffb292f9c1f5fb9e916035972e451e 100644
18--- a/internal/config/defaults.go
19+++ b/internal/config/defaults.go
20@@ -5,7 +5,9 @@ const defaultReadme = "# Soft Serve\n\n Welcome! You can configure your Soft Ser
21 const defaultConfig = `# The name of the server to show in the TUI.
22 name: Soft Serve
23 
24-# The host and port to listen on. Defaults to 0.0.0.0:23231.
25+# The host and port to display in the TUI. You may want to change this if your
26+# server is accessible from a different host and/or port that what it's
27+# actually listening on (for example, if it's behind a reverse proxy).
28 host: %s
29 port: %d
30 
31diff --git a/server/server.go b/server/server.go
32index 55916296144af06c398c1921fd972af28773e7d2..e7ab0cf23e23fd31119af8569ecc473df9c1960a 100644
33--- a/server/server.go
34+++ b/server/server.go
35@@ -32,17 +32,6 @@ func NewServer(cfg *config.Config) *Server {
36 	if err != nil {
37 		log.Fatal(err)
38 	}
39-
40-	// If the host and port are set in config.yaml, and they weren't set in the
41-	// environment, update the environment level config accordingly, which is
42-	// the config used to start the server.
43-	if cfg.Host == "" {
44-		cfg.Host = ac.Host
45-	}
46-	if cfg.Port == 0 {
47-		cfg.Port = ac.Port
48-	}
49-
50 	mw := []wish.Middleware{
51 		bm.Middleware(tui.SessionHandler(ac)),
52 		gm.Middleware(cfg.RepoPath, ac),