@@ -15,14 +15,15 @@ import (
15
15
)
16
16
17
17
var (
18
- watch bool
19
- notifyCmd string
20
- onlyExposed bool
21
- configFile string
22
- configs ConfigFile
23
- interval int
24
- endpoint string
25
- wg sync.WaitGroup
18
+ watch bool
19
+ notifyCmd string
20
+ onlyExposed bool
21
+ onlyPublished bool
22
+ configFile string
23
+ configs ConfigFile
24
+ interval int
25
+ endpoint string
26
+ wg sync.WaitGroup
26
27
)
27
28
28
29
type Event struct {
@@ -63,12 +64,13 @@ func (i *DockerImage) String() string {
63
64
}
64
65
65
66
type Config struct {
66
- Template string
67
- Dest string
68
- Watch bool
69
- NotifyCmd string
70
- OnlyExposed bool
71
- Interval int
67
+ Template string
68
+ Dest string
69
+ Watch bool
70
+ NotifyCmd string
71
+ OnlyExposed bool
72
+ OnlyPublished bool
73
+ Interval int
72
74
}
73
75
74
76
type ConfigFile struct {
@@ -198,6 +200,7 @@ func generateFromEvents(client *docker.Client, configs ConfigFile) {
198
200
func initFlags () {
199
201
flag .BoolVar (& watch , "watch" , false , "watch for container changes" )
200
202
flag .BoolVar (& onlyExposed , "only-exposed" , false , "only include containers with exposed ports" )
203
+ flag .BoolVar (& onlyPublished , "only-published" , false , "only include containers with published ports (implies -only-exposed)" )
201
204
flag .StringVar (& notifyCmd , "notify" , "" , "run command after template is regenerated" )
202
205
flag .StringVar (& configFile , "config" , "" , "config file with template directives" )
203
206
flag .IntVar (& interval , "interval" , 0 , "notify command interval (s)" )
@@ -221,12 +224,13 @@ func main() {
221
224
}
222
225
} else {
223
226
config := Config {
224
- Template : flag .Arg (0 ),
225
- Dest : flag .Arg (1 ),
226
- Watch : watch ,
227
- NotifyCmd : notifyCmd ,
228
- OnlyExposed : onlyExposed ,
229
- Interval : interval ,
227
+ Template : flag .Arg (0 ),
228
+ Dest : flag .Arg (1 ),
229
+ Watch : watch ,
230
+ NotifyCmd : notifyCmd ,
231
+ OnlyExposed : onlyExposed ,
232
+ OnlyPublished : onlyPublished ,
233
+ Interval : interval ,
230
234
}
231
235
configs = ConfigFile {
232
236
Config : []Config {config }}
0 commit comments