sanity check when creating app
This commit is contained in:
16
app.go
16
app.go
@@ -24,6 +24,22 @@ func (c *Config) NewApp(name string, sources, destinations, schedule []string, b
|
||||
log.WithFields(log.Fields{"name": name}).Debugf("starting")
|
||||
defer log.WithFields(log.Fields{"name": name}).Debugf("done")
|
||||
|
||||
if _, ok := c.apps[name]; ok {
|
||||
return nil, fmt.Errorf("app already exist")
|
||||
}
|
||||
|
||||
if len(sources) == 0 {
|
||||
return nil, fmt.Errorf("no sources")
|
||||
}
|
||||
|
||||
if len(destinations) == 0 {
|
||||
return nil, fmt.Errorf("no destinations")
|
||||
}
|
||||
|
||||
if len(schedule) == 0 {
|
||||
return nil, fmt.Errorf("no schedule")
|
||||
}
|
||||
|
||||
a := &App{
|
||||
name: name,
|
||||
sources: make([]Addr, 0),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by version.sh (@generated) DO NOT EDIT.
|
||||
package main
|
||||
var githash = "d92380c"
|
||||
var githash = "ee94b07"
|
||||
var branch = "master"
|
||||
var buildstamp = "2025-12-28_15:32:36"
|
||||
var commits = "122"
|
||||
var version = "d92380c-b122 - 2025-12-28_15:32:36"
|
||||
var buildstamp = "2025-12-28_15:41:47"
|
||||
var commits = "123"
|
||||
var version = "ee94b07-b123 - 2025-12-28_15:41:47"
|
||||
|
||||
Reference in New Issue
Block a user