From 0be507b8966e83830ed47f77a19068da05512e61 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 12 Jan 2024 04:44:36 -0600 Subject: [PATCH] ready to make a map, sort and compare Signed-off-by: Jeff Carr --- Makefile | 2 +- files/repomap | 23 +++++++++++++++++++++++ main.go | 2 ++ repoHTML.go | 21 ++++++++++++++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 files/repomap diff --git a/Makefile b/Makefile index f6626d8..99781d2 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ all: go build -v -x sudo setcap 'cap_net_bind_service=+ep' go.wit.com ./go.wit.com - # ./myrepos >/tmp/myrepos.stderr 2>&1 + @# ./myrepos >/tmp/myrepos.stderr 2>&1 redomod: rm -f go.* diff --git a/files/repomap b/files/repomap new file mode 100644 index 0000000..fc0d379 --- /dev/null +++ b/files/repomap @@ -0,0 +1,23 @@ +go.wit.com/log git.wit.org/wit/log + +go.wit.com/gui git.wit.org/gui/ +go.wit.com/gui/gui git.wit.org/gui/gui +go.wit.com/gui/widget git.wit.org/gui/widget +go.wit.com/gui/toolkits git.wit.org/gui/toolkits +go.wit.com/gui/debugger git.wit.org/gui/debugger +go.wit.com/gui/gadgets git.wit.org/gui/gadgets +go.wit.com/gui/digitalocean git.wit.org/gui/digitalocean +go.wit.com/gui/cloudflare git.wit.org/gui/cloudflare + +go.wit.com/apps/control-panel-dns git.wit.org/jcarr/control-panel-dns +go.wit.com/apps/control-panel-digitalocean git.wit.org/wit/control-panel-digitalocean +go.wit.com/apps/control-panel-cloudflare git.wit.org/wit/control-panel-cloudflare +go.wit.com/apps/control-panel-vpn git.wit.org/wit/control-panel-vpn +go.wit.com/apps/myrepos git.wit.org/jcarr/myrepos +go.wit.com/apps/go.wit.com git.wit.org/jcarr/go.wit.com + +go.wit.com/dev/alexflint/go-arg/ git.wit.org/wit/go-arg +go.wit.com/shell +git.wit.org/wit/wit-debian-gui/ +git.wit.org/jcarr/wit-new-machine +git.wit.org/jcarr/personal-gui diff --git a/main.go b/main.go index 50bfae4..609a267 100644 --- a/main.go +++ b/main.go @@ -56,6 +56,8 @@ func main() { return } */ + readconfigfile() + return http.HandleFunc("/", okHandler) err := http.ListenAndServe(":80", nil) if err != nil { diff --git a/repoHTML.go b/repoHTML.go index f30fcca..26ecd46 100644 --- a/repoHTML.go +++ b/repoHTML.go @@ -2,7 +2,8 @@ package main import ( "fmt" - // "log" + "strings" + "go.wit.com/log" "net/http" ) @@ -46,3 +47,21 @@ func doGui(w http.ResponseWriter, path string) { fmt.Fprintln(w, "OK") */ } + +func readconfigfile() { + pfile, err := htmlFiles.ReadFile("files/repomap") + if err != nil { + log.Error(err, "missing repomap in the binary") + return + } + lines := strings.Split(string(pfile), "\n") + for _, line := range lines { + fields := strings.Fields(line) + if (len(fields) < 2) { + continue + } + repo := fields[0] + realurl := fields[1] + log.Info("repo =", repo, "real url =", realurl) + } +}