#

MEMCACHE_ADDR = ['127.0.0.1:11211']

# Lock all low-level authentications (email and dav services) to
# accounts assigned to the local machine.
import socket
host = socket.gethostname().split('.')[0]

LDAP_SERVICE_MAP = {

    # Mail accounts (dovecot, nginx-mail-mapper).
    'mail': {
        'base': 'ou=People, dc=investici, dc=org, o=Anarchy',
        'filter': '(&(objectClass=virtualMailUser)(status=active)(mail=%(user)s))',
    },
 
    # DAV access (webdav fcgi handler).
    'dav': {
        'base': 'ou=People, dc=investici, dc=org, o=Anarchy',
        'filter': '(&(objectClass=ftpAccount)(status=active)(host=%(shard)s)(ftpname=%%(user)s))' % host,
    },

    # Main account (pannello).
    'account': {
        'dn': 'uid=%(user)s, ou=People, dc=investici, dc=org, o=Anarchy',
    },

}

LDAP_BIND_DN = 'cn=manager, o=Anarchy'

with open('/etc/ldap.secret') as fd:
    LDAP_BIND_PW = fd.read().strip()

# Port mapping for the dovecot service on backends.
NGINX_AUTH_PORT_MAP = {
    'pop3': 10110,
    'imap': 10143
}

