summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--config.yaml3
-rw-r--r--config/config.go4
-rw-r--r--main.go5
3 files changed, 11 insertions, 1 deletions
diff --git a/config.yaml b/config.yaml
index 2381bf0..f684779 100644
--- a/config.yaml
+++ b/config.yaml
@@ -10,3 +10,6 @@ template:
meta:
title: git good
description: i think it's a skill issue
+server:
+ host: 127.0.0.1
+ port: 5555
diff --git a/config/config.go b/config/config.go
index 65d1a71..1a29e4f 100644
--- a/config/config.go
+++ b/config/config.go
@@ -19,6 +19,10 @@ type Config struct {
Title string `yaml:"title"`
Description string `yaml:"description"`
} `yaml:"meta"`
+ Server struct {
+ Host string `yaml:"host"`
+ Port int `yaml:"port"`
+ } `yaml:"server"`
}
func Read(f string) (*Config, error) {
diff --git a/main.go b/main.go
index 07d4b67..3f8cad8 100644
--- a/main.go
+++ b/main.go
@@ -2,6 +2,7 @@ package main
import (
"flag"
+ "fmt"
"log"
"net/http"
@@ -20,5 +21,7 @@ func main() {
}
mux := routes.Handlers(c)
- log.Fatal(http.ListenAndServe(":5555", mux))
+ addr := fmt.Sprintf("%s:%d", c.Server.Host, c.Server.Port)
+ log.Println("starting server on", addr)
+ log.Fatal(http.ListenAndServe(addr, mux))
}