@@ -15,14 +15,15 @@ import (
1515)
1616
1717var (
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
2627)
2728
2829type Event struct {
@@ -63,12 +64,13 @@ func (i *DockerImage) String() string {
6364}
6465
6566type 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
7274}
7375
7476type ConfigFile struct {
@@ -198,6 +200,7 @@ func generateFromEvents(client *docker.Client, configs ConfigFile) {
198200func initFlags () {
199201 flag .BoolVar (& watch , "watch" , false , "watch for container changes" )
200202 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)" )
201204 flag .StringVar (& notifyCmd , "notify" , "" , "run command after template is regenerated" )
202205 flag .StringVar (& configFile , "config" , "" , "config file with template directives" )
203206 flag .IntVar (& interval , "interval" , 0 , "notify command interval (s)" )
@@ -221,12 +224,13 @@ func main() {
221224 }
222225 } else {
223226 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 ,
230234 }
231235 configs = ConfigFile {
232236 Config : []Config {config }}
0 commit comments