~jzs/aproxy

385e0957d78566cdbf2ced486c9253bbcfc0a5ef — Jens Zeilund Sørensen 2 years ago 18a6f09
Made aproxygo configurable only
1 files changed, 6 insertions(+), 42 deletions(-)

M aproxy.go
M aproxy.go => aproxy.go +6 -42
@@ 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{}