aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2024-12-29 08:50:47 +0800
committerRunxi Yu <me@runxiyu.org>2024-12-29 08:50:47 +0800
commitd04d8362945d39add4515db0fab22699f207af54 (patch)
tree3080f6f9cb484f9e6ebe7b564dfc6fce4a13a57d
parentRemove Nix stuff for now (diff)
downloadlegitrx-d04d8362945d39add4515db0fab22699f207af54.tar.gz
legitrx-d04d8362945d39add4515db0fab22699f207af54.tar.zst
legitrx-d04d8362945d39add4515db0fab22699f207af54.zip
Use single config value for listen addrHEADmaster
-rw-r--r--config.yaml3
-rw-r--r--config/config.go3
-rw-r--r--main.go5
3 files changed, 3 insertions, 8 deletions
diff --git a/config.yaml b/config.yaml
index a0b7a66..be722ca 100644
--- a/config.yaml
+++ b/config.yaml
@@ -16,5 +16,4 @@ meta:
description: Runxi Yu's git server thing
server:
name: git.runxiyu.org
- host: 127.0.0.1
- port: 5555
+ addr: 127.0.0.1:5555
diff --git a/config/config.go b/config/config.go
index 7c38341..e8fdcbb 100644
--- a/config/config.go
+++ b/config/config.go
@@ -25,8 +25,7 @@ type Config struct {
} `yaml:"meta"`
Server struct {
Name string `yaml:"name,omitempty"`
- Host string `yaml:"host"`
- Port int `yaml:"port"`
+ Addr string `yaml:"addr"`
} `yaml:"server"`
}
diff --git a/main.go b/main.go
index f02a8a8..b4f0785 100644
--- a/main.go
+++ b/main.go
@@ -2,7 +2,6 @@ package main
import (
"flag"
- "fmt"
"log"
"net/http"
@@ -30,7 +29,5 @@ func main() {
}
mux := routes.Handlers(c)
- addr := fmt.Sprintf("%s:%d", c.Server.Host, c.Server.Port)
- log.Println("starting server on", addr)
- log.Fatal(http.ListenAndServe(addr, mux))
+ log.Fatal(http.ListenAndServe(c.Server.Addr, mux))
}