Skip to content

Commit 3068f8a

Browse files
committed
Resort configuration types
1 parent 23b5a67 commit 3068f8a

File tree

1 file changed

+49
-48
lines changed

1 file changed

+49
-48
lines changed

sync/config.go

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,29 @@ import (
77

88
var waitGroup sync.WaitGroup
99

10-
type Filter struct {
11-
// Exclude as strings (regexp)
12-
Exclude []string `yaml:"exclude"`
13-
// compiled regexp excludes
14-
excludeRegexp []*regexp.Regexp
10+
type SyncConfig struct {
11+
// Sync (remote -> local) configurations
12+
Sync map[string]Server `yaml:"sync"`
13+
// Deploy (local -> remote) configurations
14+
Deploy map[string]Server `yaml:"deploy"`
15+
}
1516

16-
// Includes as strings (regexp)
17-
Include []string `yaml:"include"`
18-
// compiled regexp includes
19-
includeRegexp []*regexp.Regexp
17+
type Server struct {
18+
// General working path (for filesystem syncs)
19+
Path string `yaml:"path"`
20+
// General connection (default for all remote connections)
21+
Connection *YamlCommandBuilderConnection `yaml:"connection"`
22+
// Filesystem sync list
23+
Filesystem []Filesystem `yaml:"filesystem"`
24+
// Database sync list
25+
Database []Database `yaml:"database"`
26+
// Startup execution list (executed before sync)
27+
ExecStartup []Execution `yaml:"exec-startup"`
28+
// Finish execution list (executed after sync)
29+
ExecFinish []Execution `yaml:"exec-finish"`
30+
31+
// Runtime configuration (not part of configuration)
32+
runConfiguration *RunConfiguration
2033
}
2134

2235
type Filesystem struct {
@@ -34,26 +47,6 @@ type Filesystem struct {
3447
} `yaml:"options"`
3548
}
3649

37-
type DatabaseOptions struct {
38-
// Clear database with DROP/CREATE before sync
39-
ClearDatabase bool `yaml:"clear-database"`
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"`
48-
}
49-
50-
type EnvironmentVar struct {
51-
// Name of variable
52-
Name string `yaml:"name"`
53-
// Value of variable
54-
Value string `yaml:"value"`
55-
}
56-
5750
type Database struct {
5851
// Type of database (either mysql or postgres)
5952
Type string `yaml:"type"`
@@ -116,28 +109,36 @@ type Execution struct {
116109
} `yaml:"options"`
117110
}
118111

119-
type Server struct {
120-
// General working path (for filesystem syncs)
121-
Path string `yaml:"path"`
122-
// General connection (default for all remote connections)
123-
Connection *YamlCommandBuilderConnection `yaml:"connection"`
124-
// Filesystem sync list
125-
Filesystem []Filesystem `yaml:"filesystem"`
126-
// Database sync list
127-
Database []Database `yaml:"database"`
128-
// Startup execution list (executed before sync)
129-
ExecStartup []Execution `yaml:"exec-startup"`
130-
// Finish execution list (executed after sync)
131-
ExecFinish []Execution `yaml:"exec-finish"`
112+
type Filter struct {
113+
// Exclude as strings (regexp)
114+
Exclude []string `yaml:"exclude"`
115+
// compiled regexp excludes
116+
excludeRegexp []*regexp.Regexp
132117

133-
runConfiguration *RunConfiguration
118+
// Includes as strings (regexp)
119+
Include []string `yaml:"include"`
120+
// compiled regexp includes
121+
includeRegexp []*regexp.Regexp
134122
}
135123

136-
type SyncConfig struct {
137-
// Sync (remote -> local) configurations
138-
Sync map[string]Server `yaml:"sync"`
139-
// Deploy (local -> remote) configurations
140-
Deploy map[string]Server `yaml:"deploy"`
124+
type DatabaseOptions struct {
125+
// Clear database with DROP/CREATE before sync
126+
ClearDatabase bool `yaml:"clear-database"`
127+
// Arguments for mysqldump command
128+
Mysqldump *YamlStringArray `yaml:"mysqldump"`
129+
// Arguments for mysql command
130+
Mysql *YamlStringArray `yaml:"mysql"`
131+
// Arguments for pgdump command
132+
Pgdump *YamlStringArray `yaml:"pgdump"`
133+
// Arguments for psql command
134+
Psql *YamlStringArray `yaml:"psql"`
135+
}
136+
137+
type EnvironmentVar struct {
138+
// Name of variable
139+
Name string `yaml:"name"`
140+
// Value of variable
141+
Value string `yaml:"value"`
141142
}
142143

143144
type RunConfiguration struct {

0 commit comments

Comments
 (0)