Changeset - 2aef0e9f8071
[Not reviewed]
Merge
0 1 1
Sachi King - 7 years ago 2017-06-10 02:32:13
nakato@nakato.io
Merge branch 'print-warnings' into 'master'

Display failure messages when environment variables missing

See merge request !1
2 files changed with 22 insertions and 3 deletions:
0 comments (0 inline, 0 general)
dev-env.sh
Show inline comments
 
new file 100644
 
# source this for fake developer settings
 

	
 
export DJANGO_SECRET_KEY=`uuidgen -r`
 
export STRIPE_PUBLIC_KEY=`uuidgen -r`
 
export STRIPE_SECRET_KEY=`uuidgen -r`
pinaxcon/settings.py
Show inline comments
...
 
@@ -58,17 +58,31 @@ saml2_contact = {
 
    'given_name': os.environ.get("META_GIVEN_NAME", 'Bastard'),
 
    'sur_name': os.environ.get('META_FAM_NAME', 'Operator'),
 
    'company': os.environ.get('META_COMPANY', 'Corp1'),
 
    '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
 

	
 
CACHES = {
 
    'default': {
 
        'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
0 comments (0 inline, 0 general)