Moved connection to database from configuration to index