Example #1
0
File: Main.go Project: mkasep/fox
func main() {
	var nodeName string
	var port = flag.Int("port", 8090, "Port to bind to on the localhost interface")
	flag.StringVar(&nodeName, "name", "my", "Name of the running instance")
	flag.Parse()

	router := fox.NewRouter(nodeName)
	log.Printf("Starting a server on localhost:%d", *port)
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), router))
}
Example #2
0
func main() {

	var port = flag.Int("port", 8090, "Port to bind to on the localhost interface")
	var slog = flag.Bool("syslog", false, "If present, logs are sent to syslog")
	flag.Parse()

	initConfig()
	setupLogging(slog)

	router := fox.NewRouter()
	log.Infof("Starting a server on localhost:%d", *port)
	log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), router))
}
Example #3
0
import (
	"authz"
	"fox"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"util"
)

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

	var provider authz.Provider

	BeforeEach(func() {
		util.LoadConfigByName("test_config")
		fox.NewRouter()
		provider = authz.GetProvider()
	})

	Describe("Authorization querys", func() {
		BeforeEach(func() {
		})

		Context("User exists and has rights", func() {
			It("Should return true", func() {
				b := provider.IsAuthorized("fantasticmrfox", "GET", "/fox/foxes/{foxId}")
				Expect(b).To(Equal(true))
			})
		})
	})
})