loaded_backend = NULL;
}
+ if (config.use_keyd) {
+ free(config.db_backend);
+ config.db_backend = strdup("keyd");
+ }
+
if (!config.db_backend) {
logthing(LOGTHING_CRITICAL, "No database backend defined.");
exit(EXIT_FAILURE);
NULL, /* syncsites */
NULL, /* logfile */
+ false, /* use_keyd */
+
/*
* Options for directory backends.
*/
&DBFUNCS, /* Default dbfuncs struct */
};
+bool parsebool(char *str, bool fallback)
+{
+ if (!strcasecmp(str, "false") || !strcasecmp(str, "no") ||
+ !strcasecmp(str, "0")) {
+ return false;
+ } else if (!strcasecmp(str, "true") || !strcasecmp(str, "yes") ||
+ !strcasecmp(str, "1")) {
+ return true;
+ } else {
+ logthing(LOGTHING_CRITICAL,
+ "Couldn't parse %s as a boolean config variable, "
+ "returning fallback of '%s'.",
+ str,
+ fallback ? "true" : "false");
+ return fallback;
+ }
+}
+
void readconfig(const char *configfile) {
FILE *conffile;
char curline[1024];
config.db_backend = strdup(&curline[11]);
} else if (!strncmp("backends_dir ", curline, 13)) {
config.backends_dir = strdup(&curline[13]);
+ } else if (!strncmp("use_keyd ", curline, 9)) {
+ config.use_keyd = parsebool(&curline[9],
+ config.use_keyd);
} else {
logthing(LOGTHING_ERROR,
"Unknown config line: %s", curline);
struct ll *syncsites;
char *logfile;
+ /*
+ * Set if we're using keyd as the backend.
+ */
+ bool use_keyd;
+
/*
* Options for any database backend that needs a directory, be it the
* file, db2 or db3 options.
# Loglevel : 0 is highest debug, default is 3, nothing is 7+
loglevel 3
+# Should we use the keyd backend?
+use_keyd false
+
### Set www_port to the port on which HTTP requests should be accepted.
### If you do not want to process HTTP requests, set this to 0.