From f1774f007d8fbf51870a024d2bd5104ced971c45 Mon Sep 17 00:00:00 2001 From: Will Rouesnel Date: Tue, 29 Mar 2016 13:31:12 +1100 Subject: [PATCH] Add support for sorted CACHE_PEER env vars --- docker-squid/squid.bsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker-squid/squid.bsh b/docker-squid/squid.bsh index 2fc3d17..e89e5a3 100755 --- a/docker-squid/squid.bsh +++ b/docker-squid/squid.bsh @@ -45,5 +45,13 @@ chown -R proxy: /var/lib/ssl_db # Set the configuration p2 -t /squid.conf.p2 > /etc/squid4/squid.conf +# Parse the cache peer lines from the environment and add them to the +# configuration +echo '# CACHE PEERS FROM DOCKER' >> /etc/squid4/squid.conf +env | grep 'CACHE_PEER' | sort | while read cacheline; do + echo "# $cacheline " >> /etc/squid4/squid.conf + echo "cache_peer ${!cacheline}" >> /etc/squid4/squid.conf +done + squid -z -N squid -N