# Path: park_api/structs.py

# 
# Path: park_api/security.py
# def file_is_allowed(file):


import os
import importlib
import configparser
import sys
import subprocess
import logging
from park_api import structs, security


def supported_cities():
    global SUPPORTED_CITIES
    if SUPPORTED_CITIES is None:
        SUPPORTED_CITIES = load_cities()
    return SUPPORTED_CITIES


def load_config():
    global ENV
    ENV = os.getenv("env", "development")

    config_path = os.path.join(APP_ROOT, "config.ini")
    try:
        config_file = open(config_path)
    except (OSError, FileNotFoundError) as e:
        print("Failed load configuration: %s" % e)
        exit(1)
    config = configparser.ConfigParser(DEFAULT_CONFIGURATION, strict=False)
    config.read_file(config_file)

    try:
        raw_config = config[ENV]
    except KeyError:
        print("environment '%s' does not exists in config.ini" % ENV,
              file=sys.stderr)
        exit(1)

    global SERVER_CONF, DATABASE_URI, SUPPORTED_CITIES, LIVE_SCRAPE

# Path: park_api/structs.py

# 
# Path: park_api/security.py
# def file_is_allowed(file):


# Path: park_api/env.py
import os
import importlib
import configparser
import sys
import subprocess
import logging
from park_api import structs, security



def supported_cities():
    global SUPPORTED_CITIES
    if SUPPORTED_CITIES is None:
        SUPPORTED_CITIES = load_cities()
    return SUPPORTED_CITIES


def load_config():
    global ENV
    ENV = os.getenv("env", "development")

    config_path = os.path.join(APP_ROOT, "config.ini")
    try:
        config_file = open(config_path)
    except (OSError, FileNotFoundError) as e:
        print("Failed load configuration: %s" % e)
        exit(1)
    config = configparser.ConfigParser(DEFAULT_CONFIGURATION, strict=False)
    config.read_file(config_file)

    try:
        raw_config = config[ENV]
    except KeyError:
        print("environment '%s' does not exists in config.ini" % ENV,
              file=sys.stderr)
        exit(1)

    global SERVER_CONF, DATABASE_URI, SUPPORTED_CITIES, LIVE_SCRAPE

    SERVER_CONF = structs.ServerConf(host=raw_config.get('host'),