Merge branch 'print-warnings' into 'master'

Display failure messages when environment variables missing

See merge request !1
This commit is contained in:
Sachi King 2017-06-10 02:32:13 +00:00
commit 2aef0e9f80
2 changed files with 22 additions and 3 deletions

5
dev-env.sh Normal file
View file

@ -0,0 +1,5 @@
# source this for fake developer settings
export DJANGO_SECRET_KEY=`uuidgen -r`
export STRIPE_PUBLIC_KEY=`uuidgen -r`
export STRIPE_SECRET_KEY=`uuidgen -r`

View file

@ -61,11 +61,25 @@ saml2_contact = {
'email_address': os.environ.get('META_EMAIL', 'op@example.com'),
'contact_type': 'technical'},
fail = False
if (SECRET_KEY is None or PINAX_STRIPE_PUBLIC_KEY is None or
PINAX_STRIPE_SECRET_KEY is None):
sys.exit('CONFIG ERROR')
if SECRET_KEY is None:
print("FAILURE: You need to supply a DJANGO_SECRET_KEY "
"environment variable")
fail = True
if PINAX_STRIPE_PUBLIC_KEY is None:
print("FAILURE: You need to supply a STRIPE_PUBLIC_KEY "
"environment variable")
fail = True
if PINAX_STRIPE_SECRET_KEY is None:
print("FAILURE: You need to supply a STRIPE_SECRET_KEY "
"environment variable")
fail = True
if fail:
sys.exit('FAILURE: Missing environment variables.')
### Standard settings