示例#1
0
func createContext() {
	cfg := common.ContextCfg{
		Docker:   testDocker,
		Registry: testRegistry,
		Cocaine:  testCocaine,
		KeyFile:  "/Users/noxiouz/Gotest/src/github.com/cocaine/cocaine-flow/test/keyfile.cfg",
	}
	common.InitializeContext(cfg)
}
示例#2
0
func TestInit(t *testing.T) {
	cfg := common.ContextCfg{
		Docker:   testDocker,
		Registry: testRegistry,
		Cocaine:  testCocaine,
		KeyFile:  "/Users/noxiouz/Gotest/src/github.com/cocaine/cocaine-flow/test/keyfile.cfg",
	}
	err := common.InitializeContext(cfg)
	if err != nil {
		t.Fatalf("Context initialization error %s", err)
	}

	_, err = common.GetContext()
	if err != nil {
		t.Fatalf("GetContext error %s", err)
	}
}
示例#3
0
func main() {
	dockerEndpoint := flag.String("docker", "unix:///var/run/docker.sock", "dockersocket unix:// or http://")
	cocaineEndpoint := flag.String("cocaine", ":10053", "cocaine-runtime")
	registryEndpoint := flag.String("registry", ":5000", "registry endpoint")
	keyFile := flag.String("keyfile", "", "keyfile path")
	serverEndpoint := flag.String("-H", ":8080", "")
	flag.Parse()

	cfg := common.ContextCfg{
		Docker:   *dockerEndpoint,
		Registry: *registryEndpoint,
		Cocaine:  *cocaineEndpoint,
		KeyFile:  *keyFile,
	}
	err := common.InitializeContext(cfg)
	if err != nil {
		log.Fatalln(err)
	}
	h := frontHTTP.ConstructHandler()
	http.ListenAndServe(*serverEndpoint, h)
}