attr-sql: Use namespace for attr-sql config, with fallback
This commit is contained in:
parent
8dc6e71632
commit
eb9b375aa1
|
@ -61,7 +61,7 @@ static bool open_database(private_attr_sql_plugin_t *this,
|
|||
char *uri;
|
||||
|
||||
uri = lib->settings->get_str(lib->settings,
|
||||
"libhydra.plugins.attr-sql.database", NULL);
|
||||
"%s.plugins.attr-sql.database", NULL, lib->ns);
|
||||
if (!uri)
|
||||
{
|
||||
DBG1(DBG_CFG, "attr-sql plugin: database URI not set");
|
||||
|
@ -122,6 +122,8 @@ plugin_t *attr_sql_plugin_create()
|
|||
},
|
||||
},
|
||||
);
|
||||
lib->settings->add_fallback(lib->settings, "%s.plugins.attr-sql",
|
||||
"libhydra.plugins.attr-sql", lib->ns);
|
||||
|
||||
return &this->public.plugin;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ sql_attribute_t *sql_attribute_create(database_t *db)
|
|||
},
|
||||
.db = db,
|
||||
.history = lib->settings->get_bool(lib->settings,
|
||||
"libhydra.plugins.attr-sql.lease_history", TRUE),
|
||||
"%s.plugins.attr-sql.lease_history", TRUE, lib->ns),
|
||||
);
|
||||
|
||||
/* close any "online" leases in the case we crashed */
|
||||
|
|
|
@ -1227,11 +1227,16 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
|
||||
uri = lib->settings->get_str(lib->settings, "libhydra.plugins.attr-sql.database", NULL);
|
||||
/* TODO: make database URI or setting key configurable via command line */
|
||||
uri = lib->settings->get_str(lib->settings,
|
||||
"pool.database",
|
||||
lib->settings->get_str(lib->settings,
|
||||
"charon.plugins.attr-sql.database",
|
||||
lib->settings->get_str(lib->settings,
|
||||
"libhydra.plugins.attr-sql.database", NULL)));
|
||||
if (!uri)
|
||||
{
|
||||
fprintf(stderr, "database URI libhydra.plugins.attr-sql.database not set.\n");
|
||||
fprintf(stderr, "database URI pool.database not set.\n");
|
||||
exit(SS_RC_INITIALIZATION_FAILED);
|
||||
}
|
||||
db = lib->db->create(lib->db, uri);
|
||||
|
|
Loading…
Reference in New Issue