#!/usr/bin/env bash
set -e
[ -n "$DEBUG" ] && set -x

if ! command -v polipo >/dev/null ; then
  echo "$(basename $0) - polipo command not found, please install and retry"
  exit 10
fi

mkdir -p "$HOME/.polipo-cache"

exec polipo \
  proxyAddress='0.0.0.0' \
  disableIndexing='false' \
  disableServersList='false' \
  allowedClients='0.0.0.0/0' \
  diskCacheRoot='~/.polipo-cache'