Beispiel #1
0
func (t *TomlDB) loadProjectConfig(path string, f os.FileInfo, err error) error {
	if f.IsDir() || !strings.HasSuffix(f.Name(), ".toml") {
		return nil
	}

	content, err := ioutil.ReadFile(path)
	if err != nil {
		log.Errorf("TomlDB: tried to load %s, but %s", path, err)
		return nil
	}

	var p Project
	if _, err := toml.Decode(string(content), &p); err != nil {
		log.Errorf("TomlDB: tried to decode %s, but %s", path, err)
		return nil
	}

	t.projects = append(t.projects, p)
	return nil
}
Beispiel #2
0
func realMain() int {
	if *config_dir == "" {
		log.Errorf("Missing path to config directory (--config-dir | -c)")
		return 1
	}

	log.Infof("deploy-service starting")
	log.Infof("loading database")
	db := &TomlDB{}

	db.Load(*config_dir)
	log.Infof("loaded %d projects", len(db.projects))

	server := NewHttpServer(*http_port)
	server.AddHandler("/hooks/github", gitHubHookHandler(db))
	if err := server.Start(); err != nil {
		log.Errorf("Cant start hook server: %s", err)
		return 1
	}
	return 0
}
Beispiel #3
0
func TestErrorF(t *testing.T) {
	log.Errorf("errorf: %s", "asdsd")
}