#!/usr/bin/env python3

# You need install cromosoma for use this.

from paramecio.cromosoma.webmodel import WebModel
from importlib import import_module

# No touch it if you don't know what are you doing

import sys, os

paramecio_root=os.path.dirname(sys.modules['paramecio'].__file__)

#####

#server_used="wsgiref"

#Host/IP where bind the server

port=8080

debug=False

reloader=False

admin_folder='admin'

host='localhost'

allowed_ips=[]

#The theme by default

theme='default'

#Base directory for save modules

#base_modules="modules"

#Type server used for connect to the internet...

server_used="cherrypy"

#Module showed in index

default_module="welcome"

#Modules with permissions to access for users

modules=['paramecio.modules.welcome']

#The base url 

base_url='/'

#Activate sessions?

session_enabled=True

#Variables for beaker sessions

cookie_name = 'paramecio.session'

domain='localhost'

domain_url='http://localhost:8080'

#Keep this variable and don't show to anybody

key_encrypt="im smoking fool"

# Options for use redis for sessions, more scalable.

"""
session_opts = {

    'session.path': base_url,
    'session.key': cookie_name,
    'session.type': 'redis',
    'session.host': 'localhost',
    'session.port': 6379,
    'session.db': 0
}
"""

# Options for use files for sessions

session_opts = {

    'session.path': base_url,
    'session.key': cookie_name,
    'session.type': 'file',
    'session.data_dir': './sessions',
    'session.auto': False,
    'session.secret': key_encrypt,
    
}

cache_opts = {

}

"""
cache_opts = {
    
    'cache.type': 'file',
    'cache.data_dir': '/tmp/cache/data',
    'cache.lock_dir': '/tmp/cache/lock'
    
}
"""

#Can be absolute or relative

media_url='/'

#SSL support built in server. You need cherrypy installed for use this.

ssl=False

# Cert file for ssl

cert_pem=''

# Key file for ssl

privkey_pem=''

#WARNING: only use this feature in development, not in production.

yes_static=True

#Database mysql config, if you want anything...

#WebModel.connections={'default': {'name': 'default', 'host': 'localhost', 'user': 'root', 'password': '', 'db': 'example', 'charset': 'utf8mb4', 'set_connection': False} }

#Please dont change this line if you don't know what you are doing

for module in modules:
    module+='.settings.config'
    module_path=module.replace('.','/')+'.py'
    if os.path.isfile(module_path):
        mod=import_module(module)
