enum {
OPT_DEBUG = 1,
- OPT_SOURCE = 2,
- OPT_USER = 3,
+ OPT_PATH = 2,
+ OPT_SOURCE = 3,
+ OPT_USER = 4,
};
static struct argp_option options[] = {
- { "debug", OPT_DEBUG, NULL, 0, "Run in debug mode", 0 },
+ { "debug", OPT_DEBUG, NULL, 0, "Run in debug mode", 0 },
+ { "path", OPT_PATH, "PATH", 0, "Store the databases in this path", 0 },
{ "source", OPT_SOURCE, "SOURCE", 0, "Only enable this source (for testing)", 0 },
{ "user", OPT_USER, "USER", 0, "Run as user", 0 },
{ NULL },
};
+// The database path
+static const char* path = NULL;
+
// Collect all sources that should be enabled
static char** sources = NULL;
td_ctx_set_log_level(ctx, LOG_DEBUG);
break;
+ case OPT_PATH:
+ path = arg;
+ break;
+
case OPT_SOURCE:
return td_strings_append(&sources, arg);
goto ERROR;
// Create a daemon
- r = td_daemon_create(&daemon, ctx, NULL, sources);
+ r = td_daemon_create(&daemon, ctx, path, sources);
if (r < 0) {
ERROR(ctx, "Failed to initialize the daemon: %s\n", strerror(-r));
goto ERROR;