evan-buss / openbooks

Search and Download eBooks
https://evan-buss.github.io/openbooks/
MIT License
1.78k stars 58 forks source link

Unable to pass --env for proxy support #121

Closed tconnz closed 1 year ago

tconnz commented 1 year ago

Hi,

Is there a way to add proxy support for OpenBooks from within the container like on thick clients such as HexIRC etc?

I cannot pass the --env http_proxy= parameter during docker run as it gets interpreted by the openbooks server.

e.g.

docker run evanbuss/openbooks --env http_proxy="http://192.168.1.55--env http_prozy="http://192.168.1.55:3128":3128" -p 9090:80 -v ~/Downloads/openbooks:/books evanbuss/openbooks --persist --name "test"

returns

Error: unknown flag: --env
Usage:
  openbooks server [flags]

Flags:
      --basepath string        Base path where the application is accessible. For example "/openbooks/". (default "/")
  -b, --browser                Open the browser on server start.
  -d, --dir string             The directory where eBooks are saved when persist enabled. (default "/tmp/openbooks")
  -h, --help                   help for server
      --no-browser-downloads   The browser won't recieve and download eBook files, but they are still saved to the defined 'dir' path.
      --persist                Persist eBooks in 'dir'. Default is to delete after sending.
  -p, --port string            Set the local network port for browser mode. (default "5228")
  -r, --rate-limit int         The number of seconds to wait between searches to reduce strain on IRC search servers. Minimum is 10 seconds. (default 10)

Global Flags:
      --debug              Enable debug mode.
  -l, --log                Save raw IRC logs for each client connection.
  -n, --name string        Username used to connect to IRC server.
      --searchbot string   The IRC bot that handles search queries. Try 'searchook' if 'search' is down. (default "search")
  -s, --server string      IRC server to connect to. (default "irc.irchighway.net:6697")
      --tls                Connect to server using TLS. (default true)
  -u, --useragent string   UserAgent / Version Reported to IRC Server. (default "OpenBooks 4.3.0")

unknown flag: --env
Destreyf commented 1 year ago

@tconnz I'm not sure if you tried this, but put your argument flags before the image name otherwise they get passed along as part of the executable's runtime arguments.

docker run --env http_proxy="http://192.168.1.55" \
           --env http_prozy="http://192.168.1.55:3128" \
           -p 9090:80 \
           -v ~/Downloads/openbooks:/books \
           evanbuss/openbooks --persist --name "test"

I noticed while reformatting you had evanbuss/openbooks specified twice, once after the run command and again after the volume definition, which was likely the main issue with running this.

tconnz commented 1 year ago

That did the trick, thx for that! Basic error on my part. Love the project, very cool!