Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 997 Bytes

README.md

File metadata and controls

50 lines (34 loc) · 997 Bytes

Bad Origin ~ Flakey Test Servers for your ReverseProxy

When working on Reverse Proxy projects it helps to have some "fake" origin servers to round robin content from. This library lets you easily spin up servers that perform in different ways for development and testing purposes.

Status

Still working out the kinks.

Install

go get -u github.com/estivate/bad-origin

Example

package main

import (
	"flag"
	"fmt"

	"github.com/estivate/badorigin"
)

func main() {
	// are we testing? 
	var testMode bool
	flag.BoolVar(&testMode, "testMode", false, "run in test mode (default false)")
	flag.Parse()

	// if testing, launch the servers
	if testMode {
		bo := badorigin.NewServers(":8000", ":8001", ":8002")
        bo.ContentRoot = "./testing"
		bo.LaunchServers()
	}

	// spin up your real work where you are running some kind of
    // server that blocks forever.
	fmt.Println("launching a reverse proxy in front of servers here")
	// block forever
	select {}
}