コード例 #1
0
ファイル: Main.go プロジェクト: 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))
}
コード例 #2
0
ファイル: FoxService.go プロジェクト: livenson/fox
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))
}
コード例 #3
0
ファイル: authz_test.go プロジェクト: livenson/fox
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))
			})
		})
	})
})