Beispiel #1
0
func main() {
	flag.Parse()

	if version {
		handleVersion()
	}

	cfg := config.New([]config.Source{defaul.New(), file.New(conf)})
	if err := cfg.LoadDirectives(); err != nil {
		log.Fatalf("cannot load configuration: %s", err)
	}

	if showconfig {
		handleShowConfig(cfg)
	}

	d, err := daemon.New(cfg)
	if err != nil {
		log.Fatalf("cannot run clawid daemon because: %s", err)
	}

	stopChan := d.TrapSignals()
	go d.Start()
	err = <-stopChan
	if err != nil {
		log.Fatalf("daemon finished execution with error: %s", err)
	} else {
		log.Info("daemon finished execution successfuly")
		os.Exit(0)
	}
}
Beispiel #2
0
func newObject(t *testing.T) *testObject {
	mockSource := &mock_configsource.Source{}
	conf := config.New([]config.Source{mockSource})

	o := &testObject{}
	o.mockSource = mockSource
	o.conf = conf
	o.user = &entities.User{Username: "******"}

	return o
}
Beispiel #3
0
func newObject(t *testing.T) *testObject {
	mockDataController := &mock_datacontroller.DataController{}
	mockSource := &mock_configsource.Source{}
	conf := config.New([]config.Source{mockSource})

	o := &testObject{}
	o.mockSource = mockSource
	o.mockDataController = mockDataController
	o.conf = conf
	o.user = &entities.User{Username: "******"}

	// create homedir for user test
	err := os.MkdirAll("/tmp/t/test", 0755)
	require.Nil(t, err)

	return o
}