func main() {
	flag.StringVar(&flagBlobstoreSecret, "secret", "", "The secret for signing webdav url")
	flag.StringVar(&flagNetwork, "network", "", "Network type")
	flag.StringVar(&flagLocalAddress, "laddr", "", "Local network address")
	flag.Parse()

	urlSigner := signer.NewSigner(flagBlobstoreSecret)
	serverHandlers := server.NewServerHandlers(urlSigner)

	if flagNetwork == "unix" {
		os.Remove(flagLocalAddress)
	}

	s := server.NewServer(flagNetwork, flagLocalAddress, serverHandlers)
	s.Start()
}
	"github.com/cloudfoundry/blobstore_url_signer/server"
	"github.com/cloudfoundry/blobstore_url_signer/server/fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Server", func() {
	var (
		fakeHandler *fakes.FakeServerHandlers
		s           server.Server
	)

	BeforeEach(func() {
		fakeHandler = &fakes.FakeServerHandlers{}
		s = server.NewServer("tcp", ":8080", fakeHandler)
		go s.Start()
	})

	AfterEach(func() {
		s.Stop()
	})

	It("serves with the SignUrl handler", func() {
		_, err := http.Get("http://127.0.0.1:8080")

		Expect(err).ToNot(HaveOccurred())
		Expect(fakeHandler.SignUrlCallCount()).To(Equal(1))
	})
})
	"github.com/cloudfoundry/blobstore_url_signer/server/fakes"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Server", func() {

	var (
		fakeHandler *fakes.FakeServerHandlers
		s           server.Server
	)

	BeforeEach(func() {
		fakeHandler = &fakes.FakeServerHandlers{}
		s = server.NewServer(8080, "127.0.0.1", fakeHandler)
		go s.Start()
	})

	AfterEach(func() {
		s.Stop()
	})

	It("has a /sign endpoint", func() {
		_, err := http.Get("http://127.0.0.1:8080/sign")

		Expect(err).ToNot(HaveOccurred())
		Expect(fakeHandler.SignUrlCallCount()).To(Equal(1))
	})
})