Ejemplo n.º 1
0
func main() {
	flag.StringVar(&configFilePath, "config", configFilePath, "configuration file")
	flag.Parse()

	settings, err := config.ReadConfigFile(configFilePath)
	if err != nil {
		log.Fatal("FATAL while reading config files: ", err)
	}
	if len(settings.Docker) == 0 {
		log.Fatal("FATAL: empty docker configuration list:\n", settings)
	}

	client, err := dckr.NewClientFirstOf(settings.Docker)
	if err != nil {
		log.Print(err)
		log.Fatal("Failed to make any docker client, exiting")
	}

	server := server.NewServer(settings.Server, client)
	log.Println("Starting GEF server at: ", settings.Server.Address)
	err = server.Start()
	if err != nil {
		log.Println("GEF server failed: ", err)
	}
}
Ejemplo n.º 2
0
func TestServer(t *testing.T) {
	settings, err := config.ReadConfigFile(configFilePath)
	if err != nil {
		t.Error("FATAL while reading config files: ", err)
	}
	clientConf = settings.Docker

	c := newClient(t)
	s := server.NewServer(settings.Server, c)

	srv := httptest.NewServer(s.Server.Handler)
	baseURL := srv.URL + "/api/"

	checkIfAPIExist(baseURL, t)
	callListVolumesHandler(baseURL+"volumes", t)
	callListJobsHandler(baseURL+"jobs", t)
	callListServicesHandler(baseURL+"images", t)
}