all repos — legit @ 462c7ddc70f7c4da9515298439246f3b40b244f5

web frontend for git, written in go

config: server host and port
Anirudh Oppiliappan x@icyphox.sh
Mon, 12 Dec 2022 22:58:23 +0530
commit

462c7ddc70f7c4da9515298439246f3b40b244f5

parent

60e1092dbcfacb28b30d052b0f73d2249cd63a9d

3 files changed, 11 insertions(+), 1 deletions(-)

jump to
M config.yamlconfig.yaml

@@ -10,3 +10,6 @@ dir: ./templates

meta: title: git good description: i think it's a skill issue +server: + host: 127.0.0.1 + port: 5555
M config/config.goconfig/config.go

@@ -19,6 +19,10 @@ Meta 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) {
M main.gomain.go

@@ -2,6 +2,7 @@ package main

import ( "flag" + "fmt" "log" "net/http"

@@ -20,5 +21,7 @@ log.Fatal(err)

} 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)) }