forked from Telodendria/Telodendria
Add a Db to the matrixArgs so that routes can access it.
This commit is contained in:
parent
3a181653b5
commit
f90b987218
2 changed files with 18 additions and 0 deletions
|
@ -38,6 +38,7 @@
|
|||
#include <Config.h>
|
||||
#include <HttpServer.h>
|
||||
#include <Matrix.h>
|
||||
#include <Db.h>
|
||||
|
||||
static void
|
||||
TelodendriaMemoryHook(MemoryAction a, MemoryInfo * i, void *args)
|
||||
|
@ -418,6 +419,20 @@ main(int argc, char **argv)
|
|||
tConfig->uid = NULL;
|
||||
tConfig->gid = NULL;
|
||||
|
||||
matrixArgs.db = DbOpen(".", tConfig->maxCache);
|
||||
|
||||
if (!tConfig->maxCache)
|
||||
{
|
||||
Log(lc, LOG_WARNING, "Max-cache is set to zero; caching is disabled.");
|
||||
}
|
||||
|
||||
if (!matrixArgs.db)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to open data directory as a database.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
Log(lc, LOG_TASK, "Starting server...");
|
||||
|
||||
if (!HttpServerStart(httpServer))
|
||||
|
@ -452,6 +467,7 @@ finish:
|
|||
Log(lc, LOG_DEBUG, "Freed HTTP Server.");
|
||||
}
|
||||
TelodendriaConfigFree(tConfig);
|
||||
DbClose(matrixArgs.db);
|
||||
|
||||
Log(lc, LOG_DEBUG, "");
|
||||
MemoryIterate(TelodendriaMemoryIterator, lc);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <HashMap.h>
|
||||
|
||||
#include <TelodendriaConfig.h>
|
||||
#include <Db.h>
|
||||
|
||||
/*
|
||||
* Abstract away the underlying data structure of the path so that
|
||||
|
@ -90,6 +91,7 @@ typedef struct MatrixHttpHandlerArgs
|
|||
{
|
||||
LogConfig *lc;
|
||||
TelodendriaConfig *config;
|
||||
Db *db;
|
||||
} MatrixHttpHandlerArgs;
|
||||
|
||||
extern void
|
||||
|
|
Loading…
Reference in a new issue