import deuce

# Server Specific Configurations
server = {
    'port': '8080',
    'host': '0.0.0.0'
}


def get_hooks():
    from deuce.hooks import ProjectIDHook
    return [ProjectIDHook()]

# Pecan Application Configurations
app = {
    'root': 'deuce.controllers.root.RootController',
    'modules': ['deuce'],
    'static_root': '%(confdir)s/../../public',
    'template_path': '%(confdir)s/../../deuce/templates',
    'debug': True,
    'hooks': get_hooks(),
    'errors': {
        404: '/error/404',
        '__force_dict__': True
    }
}

logging = {
    'loggers': {
        'root': {'level': 'INFO', 'handlers': ['console']},
        'deuce': {'level': 'DEBUG', 'handlers': ['console']},
        'py.warnings': {'handlers': ['console']},
        '__force_dict__': True
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple'
        }
    },
    'formatters': {
        'simple': {
            'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
                       '[%(threadName)s] %(message)s')
        }
    }
}

import os

if not os.path.exists('/tmp/block_storage'):
    os.mkdir('/tmp/block_storage')

block_storage_driver = {
    'driver': 'deuce.drivers.storage.blocks.disk.DiskStorageDriver',
    'options': {
        'path': '/tmp/block_storage'
    }
}

metadata_driver = {
    #'driver': 'deuce.metadata.driver.SqliteStorageDriver',
    #'path': 'deuce.drivers.storage.metadata.sqlite.sqlitestoragedriver',
    #'module': 'SqliteStorageDriver',
    'driver': 'deuce.metadata.driver.MongoDbStorageDriver',
    'path': 'deuce.drivers.storage.metadata.mongodb.mongodbstoragedriver',
    'module': 'MongoDbStorageDriver',
    'options': {
        'path': 'vaultmeta',
        'url': 'mongodb://127.0.0.1'
    }
}

api_configuration = {
    'max_returned_num': 10
}

# Always remove the database so that we can start over on
# test execution

##Drop sqlite DB
##if os.path.exists('/tmp/vaultmeta.db'):
##    os.remove('/tmp/vaultmeta.db')

##Drop Mongo DB
import pymongo
from pymongo import MongoClient
client = MongoClient('mongodb://127.0.0.1')
_conn = client['vaultmeta']
#_conn.drop_collection('blocks')
#_conn.drop_collection('fileblocks')
#_conn.drop_collection('files')



@@ -1375,16 +1375,17 @@
    %7D%0A%7D%0A%0A
+%0A
 metadata
@@ -1400,17 +1400,16 @@
 = %7B%0A    
-#
 'driver'
@@ -1459,18 +1459,24 @@
 r',%0A    
-#
 '
+driver_
 path': '
@@ -1539,17 +1539,16 @@
 r',%0A    
-#
 'module'
@@ -1564,32 +1564,393 @@
 StorageDriver',%0A
+    'options': %7B%0A        'path': '/tmp/vaultmeta.db'%0A    %7D,%0A    'sqlite':%7B%0A        'driver': 'deuce.metadata.driver.SqliteStorageDriver',%0A        'driver_path': 'deuce.drivers.storage.metadata.sqlite.sqlitestoragedriver',%0A        'module': 'SqliteStorageDriver',%0A        'options': %7B%0A            'path': '/tmp/vaultmeta.db'%0A        %7D%0A    %7D,%0A    'mongodb':%7B%0A    
     'driver': 'd
@@ -1993,25 +1993,36 @@
 river',%0A    
-'
+    'driver_
 path': 'deuc
@@ -2075,32 +2075,36 @@
 agedriver',%0A    
+ 
+   
 'module': 'Mongo
@@ -2113,32 +2113,36 @@
 StorageDriver',%0A
+    
     'options': %7B
@@ -2142,32 +2142,36 @@
 ons': %7B%0A        
+    
 'path': 'vaultme
@@ -2183,16 +2183,20 @@
         
+  
+  
 'url': '
@@ -2216,16 +2216,26 @@
 .0.0.1'%0A
+        %7D%0A
     %7D%0A%7D%0A
@@ -2380,18 +2380,16 @@
 lite DB%0A
-##
 if os.pa
@@ -2420,18 +2420,16 @@
 a.db'):%0A
-##
     os.r
@@ -2591,17 +2591,16 @@
 tmeta'%5D%0A
-#
 _conn.dr
@@ -2615,33 +2615,32 @@
 ction('blocks')%0A
-#
 _conn.drop_colle
@@ -2659,17 +2659,16 @@
 locks')%0A
-#
 _conn.dr
@@ -2690,10 +2690,8 @@
 files')%0A
-%0A%0A

create different conf sets for different drivers