import os
import json

from base import *
from server.settings.settings_model import Settings

DEBUG = False

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')

DEFAULT_DB_ALIAS = 'default'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'HOST': '/cloudsql/nimble-airline-178615:europe-west1:techbikers-db',
        'PORT': '3306',
        'NAME': 'techbikers',
        'USER': Settings.get('TECHBIKERS_DB_USER'),
        'PASSWORD': Settings.get('TECHBIKERS_DB_PASSWORD')
    }
}

ALLOWED_HOSTS = ['api.techbikers.com']

STRIPE_ENVIRONMENT = 'live'

SECRET_KEY = Settings.get('SECRET_KEY')

# Sendgrid API
SENDGRID_API_KEY = Settings.get('SENDGRID_API_KEY')

# Mailchimp API
MAILCHIMP_API_URL = Settings.get('MAILCHIMP_API_URL')
MAILCHIMP_API_KEY = Settings.get('MAILCHIMP_API_KEY')
MAILCHIMP_CORE_LIST_ID = Settings.get('MAILCHIMP_CORE_LIST_ID')

# Just Giving API
JUSTGIVING_API_KEY = Settings.get('JUSTGIVING_API_KEY')
JUSTGIVING_API_SECRET = Settings.get('JUSTGIVING_API_SECRET')
JUSTGIVING_API_URL = 'https://api.justgiving.com/v1'

# Slack Bot Settings
SLACK_CHANNEL = '#updates'
SLACK_TOKEN = Settings.get('SLACK_BOT_TOKEN')
SLACK_BACKEND = 'django_slack.backends.UrllibBackend'

# Auth0 Settings
AUTH0_CLIENT_ID = Settings.get('AUTH0_CLIENT_ID')
AUTH0_CLIENT_SECRET = Settings.get('AUTH0_CLIENT_SECRET')

# Auth0 uses the client ID as the audience (note that this is not the same
# client as above). We need to set this so we can properly verify tokens
# sent to us during API requests
JWT_AUTH['JWT_AUDIENCE'] = Settings.get('AUTH0_WEB_CLIENT_ID')

RAVEN_CONFIG = {
    'dsn': Settings.get('SENTRY_DSN')
}

MEDIA_ROOT = '/home/django/techbikers.com/media'
STATIC_ROOT = '/home/django/techbikers.com/static'

@@ -565,16 +565,53 @@
 ers.com'
+, 'nimble-airline-178615.appspot.com'
 %5D%0A%0ASTRIP

Add the App Engine domain as a valid host