From 385e0957d78566cdbf2ced486c9253bbcfc0a5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Zeilund=20S=C3=B8rensen?= Date: Tue, 24 Jul 2018 16:17:17 +0200 Subject: [PATCH] Made aproxygo configurable only --- aproxy.go | 48 ++++++------------------------------------------ 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/aproxy.go b/aproxy.go index bdbc9f2..ca21b15 100644 --- a/aproxy.go +++ b/aproxy.go @@ -27,49 +27,8 @@ type Config struct { } func main() { - cfgs := []Config{ - Config{ - Host: "sketchground.dk", - Server: "http://127.0.0.1:9901", - }, - Config{ - Host: "www.sketchground.dk", - Server: "http://127.0.0.1:9901", - }, - Config{ - Host: "blog.sketchground.dk", - Server: "http://127.0.0.1:9900", - }, - Config{ - Host: "pomodoro.sketchground.dk", - Server: "static:///var/www/pomodoro.sketchground.dk", - }, - Config{ - Host: "journal.sketchground.dk", - Server: "http://127.0.0.1:9900", - }, - Config{ - Host: "rutebil.dk", - Server: "static:///var/www/rutebildk", - }, - Config{ - Host: "ikurven.dk", - Server: "static:///var/www/ikurvendk", - }, - Config{ - Host: "www.rutebil.dk", - Server: "static:///var/www/rutebildk", - }, - Config{ - Host: "www.ikurven.dk", - Server: "static:///var/www/ikurvendk", - }, - } - + cfgs := []Config{} flag.Parse() - if len(flag.Args()) > 0 { - cfgs = []Config{} - } for _, a := range flag.Args() { arg := strings.Split(a, "=") if len(arg) != 2 { @@ -86,6 +45,11 @@ func main() { server := data[1] cfgs = append(cfgs, Config{Host: host, Server: server}) } + if len(cfgs) == 0 { + // Return error... + log.Println("Expected to get configs for a domain, got %v configs", len(cfgs)) + log.Fatal("Usage: aproxygo host=domain;static://... host=domain;http://127.0.0.1:8080...") + } hosts := []string{} -- 2.30.1