Skip to content

Commit

Permalink
Honor the host and port settings in the YAML config
Browse files Browse the repository at this point in the history
Note that precedence will be given to the environment variables.

Fixes #38.
  • Loading branch information
meowgorithm committed Dec 10, 2021
1 parent 3b51af4 commit de9cf14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ func NewServer(cfg *config.Config) *Server {
if err != nil {
log.Fatal(err)
}

// If the host and port are set in config.yaml, and they weren't set in the
// environment, update the environment level config accordingly, which is
// the config used to start the server.
if cfg.Host == "" {
cfg.Host = ac.Host
}
if cfg.Port == 0 {
cfg.Port = ac.Port
}

mw := []wish.Middleware{
bm.Middleware(tui.SessionHandler(ac)),
gm.Middleware(cfg.RepoPath, ac),
Expand Down

0 comments on commit de9cf14

Please sign in to comment.