Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Bugfix/Fix sslmode with custom sqlite path and on Heroku #189
There is an issue in dj-database-url which always sets the sslmode even if the underlying engine doesn't support SSL. See also the conversation with @deltatree on #170 for more information.
This change implements a work-around for both behaviors.
Let me arrange the issue (it'll be a little bothering, but please forgive me because it is security matter).
User can not use non-SSL connection at the development environment.
We can overwrite database setting after
import django_heroku import dj_database_url django_heroku.settings(locals()) # override DATABASE_URL set by django_heroku because it forces SSL mode locally ssl_require = os.environ['ENV'] != 'development' locals()['DATABASES']['default'] = dj_database_url.config( conn_max_age=django_heroku.MAX_CONN_AGE, ssl_require=ssl_require)
To use environment variable
Can we use
As for using the
@c-w Thank you for your hard work!
Finally, let me confirm the code.
ssl_require='sslmode' not in furl(env('DATABASE_URL', '')).args
So please add test code for
@icoxfog417 You're correct. if
I've added the new test case in 756fff8.