import os
from environs import Env

env = Env()
env.read_env()

PRESALYTICS = {
    'USERNAME': os.environ['PRESALYTICS_USERNAME'],
    'PASSWORD': os.environ['PRESALYTICS_PASSWORD'],
    'CLIENT_ID': os.environ.get('CLIENT_ID'),
    'CLIENT_SECRET': os.environ.get('CLIENT_SECRET'),
    'HOSTS': {},
    'BROWSER_API_HOST': {}
}

try:
    ooxml_host = {
        'OOXML_AUTOMATION': os.environ['OOXML_AUTOMATION_HOST']
    }
    PRESALYTICS['HOSTS'].update(ooxml_host)
except KeyError:
    pass

try:
    story_host = {
        'STORY': os.environ['STORY_HOST'] + "/story"
    }
    PRESALYTICS['HOSTS'].update(story_host)
except KeyError:
    pass


try:
    site_host = {
        'SITE': os.environ['SITE_HOST']
    }
    PRESALYTICS['HOSTS'].update(site_host)
except KeyError:
    pass

try:
    PRESALYTICS['BROWSER_API_HOST']['STORY'] = os.environ['BROWSER_API_HOST_STORY']
except KeyError:
    pass

try:
    PRESALYTICS['BROWSER_API_HOST']['OOXML_AUTOMATION'] = os.environ['BROWSER_API_HOST_OOXML_AUTOMATION']
except KeyError:
    pass

