@@ -8,91 +8,143 @@ import (
8
8
var waitGroup sync.WaitGroup
9
9
10
10
type Filter struct {
11
+ // Exclude as strings (regexp)
11
12
Exclude []string `yaml:"exclude"`
13
+ // compiled regexp excludes
12
14
excludeRegexp []* regexp.Regexp
15
+
16
+ // Includes as strings (regexp)
13
17
Include []string `yaml:"include"`
18
+ // compiled regexp includes
14
19
includeRegexp []* regexp.Regexp
15
20
}
16
21
17
22
type Filesystem struct {
23
+ // Remove path
18
24
Path string `yaml:"path"`
25
+ // Local path (optional)
19
26
Local string `yaml:"local"`
27
+ // Filter
20
28
Filter Filter `yaml:"filter"`
29
+ // Connection for filesystem sync (optional, default is Server connection)
21
30
Connection * YamlCommandBuilderConnection `yaml:"connection"`
22
31
Options struct {
32
+ // Generate stubs (small example files) instead of fetching files from remote
23
33
GenerateStubs bool `yaml:"generate-stubs"`
24
34
} `yaml:"options"`
25
35
}
26
36
27
37
type DatabaseOptions struct {
38
+ // Clear database with DROP/CREATE before sync
28
39
ClearDatabase bool `yaml:"clear-database"`
29
- Mysqldump string `yaml:"mysqldump"`
30
- Mysql string `yaml:"mysql"`
31
- Pgdump string `yaml:"pgdump"`
32
- Psql string `yaml:"psql"`
40
+ // Arguments for mysqldump command
41
+ Mysqldump * YamlStringArray `yaml:"mysqldump"`
42
+ // Arguments for mysql command
43
+ Mysql * YamlStringArray `yaml:"mysql"`
44
+ // Arguments for pgdump command
45
+ Pgdump * YamlStringArray `yaml:"pgdump"`
46
+ // Arguments for psql command
47
+ Psql * YamlStringArray `yaml:"psql"`
33
48
}
34
49
35
50
type EnvironmentVar struct {
51
+ // Name of variable
36
52
Name string `yaml:"name"`
53
+ // Value of variable
37
54
Value string `yaml:"value"`
38
55
}
39
56
40
57
type Database struct {
58
+ // Type of database (either mysql or postgres)
41
59
Type string `yaml:"type"`
60
+ // Database name on remote database server
42
61
Db string `yaml:"database"`
62
+ // Hostname of remote database server
43
63
Hostname string `yaml:"hostname"`
64
+ // Port of remote database server
44
65
Port string `yaml:"port"`
66
+ // Username of remote database server
45
67
User string `yaml:"user"`
68
+ // Password of remote database server
46
69
Password string `yaml:"password"`
47
70
71
+ // Table filter
48
72
Filter Filter `yaml:"filter"`
73
+ // Connection for database sync (optional, default is Server connection)
49
74
Connection * YamlCommandBuilderConnection `yaml:"connection"`
75
+ // Database options
50
76
Options DatabaseOptions `yaml:"options"`
51
77
52
78
Local struct {
53
- Type string `yaml:"type"`
79
+ // Database name on local database server
54
80
Db string `yaml:"database"`
81
+ // Hostname of local database server
55
82
Hostname string `yaml:"hostname"`
83
+ // Port of local database server
56
84
Port string `yaml:"port"`
85
+ // Username of local database server
57
86
User string `yaml:"user"`
87
+ // Password of local database server
58
88
Password string `yaml:"password"`
59
89
90
+ // Connection for database sync (optional, default is empty)
60
91
Connection * YamlCommandBuilderConnection `yaml:"connection"`
92
+
93
+ // Database options
61
94
Options DatabaseOptions `yaml:"options"`
62
95
} `yaml:"local"`
63
96
64
- // local cache
97
+ // local cache for remote table list
65
98
cacheRemoteTableList []string
99
+ // local cache for local table list
66
100
cacheLocalTableList []string
67
101
}
68
102
69
103
type Execution struct {
104
+ // Type of execution (remote or local)
70
105
Type string `yaml:"type"`
106
+ // Command as string or as elements
71
107
Command YamlStringArray `yaml:"command"`
108
+ // Workdir for execution
72
109
Workdir string `yaml:"workdir"`
110
+
111
+ // Environment variables
73
112
Environment []EnvironmentVar `yaml:"environment"`
113
+
114
+ // Execution options
74
115
Options struct {
75
116
} `yaml:"options"`
76
117
}
77
118
78
119
type Server struct {
120
+ // General working path (for filesystem syncs)
79
121
Path string `yaml:"path"`
122
+ // General connection (default for all remote connections)
80
123
Connection * YamlCommandBuilderConnection `yaml:"connection"`
124
+ // Filesystem sync list
81
125
Filesystem []Filesystem `yaml:"filesystem"`
126
+ // Database sync list
82
127
Database []Database `yaml:"database"`
128
+ // Startup execution list (executed before sync)
83
129
ExecStartup []Execution `yaml:"exec-startup"`
130
+ // Finish execution list (executed after sync)
84
131
ExecFinish []Execution `yaml:"exec-finish"`
85
132
86
133
runConfiguration * RunConfiguration
87
134
}
88
135
89
136
type SyncConfig struct {
137
+ // Sync (remote -> local) configurations
90
138
Sync map [string ]Server `yaml:"sync"`
139
+ // Deploy (local -> remote) configurations
91
140
Deploy map [string ]Server `yaml:"deploy"`
92
141
}
93
142
94
143
type RunConfiguration struct {
144
+ // Enable database sync
95
145
Database bool
146
+ // Enable filesystem sync
96
147
Filesystem bool
148
+ // Enable exec runner
97
149
Exec bool
98
150
}
0 commit comments