Skip to content

estivate/badorigin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published