Add EXTRA_CONFIG and CONFIG_DISABLE options.
This commit is contained in:
parent
2d8754341c
commit
a33398b6d5
|
@ -45,7 +45,14 @@ variables:
|
||||||
Cache peers for the squid instance may be specified with multiple CACHE_PEER
|
Cache peers for the squid instance may be specified with multiple CACHE_PEER
|
||||||
environment variables. The suffix of each is used to determine ordering by
|
environment variables. The suffix of each is used to determine ordering by
|
||||||
the unix `sort` function.
|
the unix `sort` function.
|
||||||
|
* `EXTRA_CONFIGx`
|
||||||
|
Extra non-specific configuration lines to be appended after the main body of
|
||||||
|
the configuration file. This is a good place for custom ACL parameters.
|
||||||
|
* `CONFIG_DISABLE`
|
||||||
|
Default `no`
|
||||||
|
If set to `yes` then squid configuration templating is disabled entirely, allowing
|
||||||
|
bind mounting the configuration file in manually instead. The certificate and SSL
|
||||||
|
setup still runs normally.
|
||||||
|
|
||||||
# Example Usage
|
# Example Usage
|
||||||
The following command line will get you up and running quickly. It presumes
|
The following command line will get you up and running quickly. It presumes
|
||||||
|
|
|
@ -43,15 +43,31 @@ chown -R proxy: /var/lib/ssl_db
|
||||||
#ssl_db
|
#ssl_db
|
||||||
|
|
||||||
# Set the configuration
|
# Set the configuration
|
||||||
p2 -t /squid.conf.p2 > /etc/squid4/squid.conf
|
if [ "$CONFIG_DISABLE" != "yes" ]; then
|
||||||
|
p2 -t /squid.conf.p2 > /etc/squid4/squid.conf
|
||||||
|
|
||||||
# Parse the cache peer lines from the environment and add them to the
|
# Parse the cache peer lines from the environment and add them to the
|
||||||
# configuration
|
# configuration
|
||||||
echo '# CACHE PEERS FROM DOCKER' >> /etc/squid4/squid.conf
|
echo '# CACHE PEERS FROM DOCKER' >> /etc/squid4/squid.conf
|
||||||
env | grep 'CACHE_PEER' | sort | while read cacheline; do
|
env | grep 'CACHE_PEER' | sort | while read cacheline; do
|
||||||
echo "# $cacheline " >> /etc/squid4/squid.conf
|
echo "# $cacheline " >> /etc/squid4/squid.conf
|
||||||
echo "cache_peer ${!cacheline}" >> /etc/squid4/squid.conf
|
echo "cache_peer ${!cacheline}" >> /etc/squid4/squid.conf
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Parse the extra config lines and append them to the configuration
|
||||||
|
echo '# EXTRA CONFIG FROM DOCKER' >> /etc/squid4/squid.conf
|
||||||
|
env | grep 'EXTRA_CONFIG' | sort | while read extraline; do
|
||||||
|
echo "# $extraline " >> /etc/squid4/squid.conf
|
||||||
|
echo "${!extraline}" >> /etc/squid4/squid.conf
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "CONFIGURATION TEMPLATING IS DISABLED."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e /etc/squid4/squid.conf ]; then
|
||||||
|
echo "ERROR: /etc/squid4/squid.conf does not exist. Squid will not work."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
squid -z -N
|
squid -z -N
|
||||||
squid -N
|
squid -N
|
||||||
|
|
Loading…
Reference in New Issue