File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -63,15 +63,15 @@ type Execution struct {
63
63
Type string
64
64
Command YamlStringArray
65
65
Workdir string
66
- When string
67
66
}
68
67
69
68
type Server struct {
70
69
Path string
71
70
Connection Connection
72
71
Filesystem []Filesystem
73
72
Database []Database
74
- Exec []Execution
73
+ ExecStartup []Execution `yaml:"exec-startup"`
74
+ ExecFinish []Execution `yaml:"exec-finish"`
75
75
}
76
76
77
77
type SyncConfig struct {
Original file line number Diff line number Diff line change 1
1
package sync
2
2
3
+ import "fmt"
4
+
3
5
func (server * Server ) RunExec (when string ) {
4
6
defer func () {
5
7
recover := recover ()
@@ -19,11 +21,12 @@ func (server *Server) RunExec(when string) {
19
21
}
20
22
21
23
func (server * Server ) GetExecByWhen (when string ) []Execution {
22
- var execList []Execution
23
-
24
- for _ , val := range server .Exec {
25
- execList = append (execList , val )
24
+ switch when {
25
+ case "startup" :
26
+ return server .ExecStartup
27
+ case "finish" :
28
+ return server .ExecFinish
29
+ default :
30
+ panic (fmt .Sprintf ("execution list %s is not valid" , when ))
26
31
}
27
-
28
- return execList
29
32
}
You can’t perform that action at this time.
0 commit comments