File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,8 @@ Environment Variables:
156156 DOCKER_HOST - default value for -endpoint
157157 DOCKER_CERT_PATH - directory path containing key.pem, cert.pem and ca.pem
158158 DOCKER_TLS_VERIFY - enable client TLS verification
159+ DOCKER_CONTAINER_FILTERS - comma separated list of container filters for inclusion by docker-gen.
160+ Filters supplied through this variable are ignored if -container-filter is provided.
159161```
160162
161163If no ` <dest> ` file is specified, the output is sent to stdout. Mainly useful for debugging.
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ Environment Variables:
8686 DOCKER_HOST - default value for -endpoint
8787 DOCKER_CERT_PATH - directory path containing key.pem, cert.pem and ca.pem
8888 DOCKER_TLS_VERIFY - enable client TLS verification
89+ DOCKER_CONTAINER_FILTERS - comma separated list of container filters for inclusion by docker-gen.
90+ Filters supplied through this variable are ignored if -container-filter is provided.
8991` )
9092 println (`For more information, see https://github.com/nginx-proxy/docker-gen` )
9193}
@@ -149,6 +151,15 @@ func initFlags() {
149151
150152 flag .Usage = usage
151153 flag .Parse ()
154+
155+ // set containerFilter with DOCKER_CONTAINER_FILTERS if it's set and no -container-filter option was provided
156+ if filtersEnvVar , found := os .LookupEnv ("DOCKER_CONTAINER_FILTERS" ); found && len (containerFilter ) == 0 {
157+ for filter := range strings .SplitSeq (filtersEnvVar , "," ) {
158+ if trimmedFilter := strings .TrimSpace (filter ); trimmedFilter != "" {
159+ containerFilter .Set (trimmedFilter )
160+ }
161+ }
162+ }
152163}
153164
154165func main () {
You can’t perform that action at this time.
0 commit comments