jpetazzo / squid-in-a-can

361 stars 78 forks source link

Add a few lines in squid.conf #22

Closed e-minguez closed 7 years ago

e-minguez commented 8 years ago

Readme says:

SQUID_DIRECTIVES This will append any contents of the environment variable to squid.conf. It is expected that you will use multi-line block quote for the contents.

And I want to redirect squid to another squid (http://wiki.squid-cache.org/Features/CacheHierarchy) which translates to something like:

cache_peer parentcache.foo.com parent 3128 0 no-query default
never_direct allow all

I've tried setting SQUID_DIRECTIVES with double quotes, single quotes, with \n, \n,... but it doesn't work with multiline, it always store the variable in the squid configuration file as a single line:

docker run --name squid-in-a-can --net host -d -e="cache_peer parentcache.foo.com parent 3128 0 no-query default \n never_direct allow all" jpetazzo/squid-in-a-can
jpetazzo commented 7 years ago

This will do the trick:

docker run --name squid-in-a-can --net host -d \
    -e SQUID_DIRECTIVES="
# hi ho hi ho
# we're doing block I/O
# hi ho hi ho
" jpetazzo/squid-in-a-can