from fabric.api import env
from random import choice

env.hosts = ['<user>@<server>']

env.web_group = 'iri'
env.folders = ['log', 'static/media']

env.repos = {'iconolab' : {'repo':"<path to repo>", 'src_root':'src', 'requirements': 'requirements/prod.txt', 'python_version': '3.5'}}
env.base_export_path = "/tmp"
env.export_prefix = "iconolab"
env.key = 'iconolab'

env.remote_path = {
    'web':"/etc/www/iconolab/",
    'src':"/etc/www/iconolab",
    'virtualenv':"/srv/virtualenv/iconolab",
    'build_export':"/tmp/build",
    'pythonpath' : ['/etc/www/iconolab']
}

#env.remote_path = {
#    'web':"/var/www/iconolab/",
#    'src':"/Users/ymh/dev/tmp/testfab/src",
#    'virtualenv':"/Users/ymh/dev/tmp/testiconolab/virtualenv/iconolab",
#    'build_export':"/tmp/build",
#    'pythonpath' : ['/etc/www/iconolab']
#}


env.platform_web_module = "iconolab"
env.remote_baseline_venv = ""

env.rsync_filters = {
    'src' : [
        "P .htpasswd",
        "P .htaccess",
        "P egonomy/config.py",
    ],
    'web': [
        "+ core",
        "P .htpasswd",
        "P .htaccess",
        "P robots.txt",
        "P env/***",
        "P log/***",
        "P index/***",
        "P static/media/***",
        "P crossdomain.xml",
    ],
    'venv': [
        "+ core",
    ]
}
env.web_relaunch_cmd = "supervisorctl restart iconolab"
env.settings = "iconolab_settings"
env.admin_cmd = "django-admin"
env.check_folder_access = False

env.config = {
    'web': {
        'base_url': "/",
        'web_url': 'http://egonomy.iri-resesarch.org',
        'db_engine':'postgresql_psycopg2',
        'db_name':'platform',
        'db_user': 'iriuser',
        'db_password': '',
        'db_host': 'sql.iri.centrepompidou.fr',
        'db_port': 5432,
        'haystack_url' : 'http://localhost:9200',
        'haystack_index' : 'egonomy',
        'log_file' : env.remote_path['web'] + '/log/log.txt',
        'secret_key' : ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]),
    },
}
