Skip to content

Commit

Permalink
Add ca_certs config option for setting custom CA cert path.
Browse files Browse the repository at this point in the history
This was necessary to solve an issue on a Heroku deploy where the CA
default bundle was not being detected automatically.
  • Loading branch information
xtagon authored and agschwender committed Jul 16, 2016
1 parent 4b93eb5 commit a0d1ec8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ To see a list of all available options, run
--allowed_hosts list of allowed hosts (default [])
--allowed_operations list of allowed operations (default [])
--background default hexadecimal bg color (RGB or ARGB)
--ca_certs filename of CA certificates in PEM format,
or None to use defaults
--client_key client key
--client_name client name
--config path to configuration file
Expand Down
5 changes: 5 additions & 0 deletions pilbox/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
define("max_requests", help="max concurrent requests", type=int, default=40)
define("timeout", help="request timeout in seconds", type=float, default=10)
define("implicit_base_url", help="prepend protocol/host to url paths")
define("ca_certs",
help="override filename of CA certificates in PEM format",
default=None)
define("validate_cert", help="validate certificates", type=bool, default=True)
define("proxy_host", help="proxy hostname")
define("proxy_port", help="proxy port", type=int)
Expand Down Expand Up @@ -108,6 +111,7 @@ def __init__(self, **kwargs):
max_requests=options.max_requests,
timeout=options.timeout,
implicit_base_url=options.implicit_base_url,
ca_certs=options.ca_certs,
validate_cert=options.validate_cert,
content_type_from_image=options.content_type_from_image,
proxy_host=options.proxy_host,
Expand Down Expand Up @@ -183,6 +187,7 @@ def fetch_image(self):
resp = yield client.fetch(
url,
request_timeout=self.settings.get("timeout"),
ca_certs=self.settings.get("ca_certs"),
validate_cert=self.settings.get("validate_cert"),
proxy_host=self.settings.get("proxy_host"),
proxy_port=self.settings.get("proxy_port"))
Expand Down

0 comments on commit a0d1ec8

Please sign in to comment.