MantisBase v0.4.9
Loading...
Searching...
No Matches
mb::MbKVStore Class Reference

Manages application settings. More...

#include <kv_store.h>

Public Member Functions

 MbKVStore (MantisBase &app)
 Construct the settings store bound to an application.
bool setupRoutes ()
 Initialize and set up routes for fetching settings data.
void migrate ()
 Initialize migration, create base data for setting fields.
json & configs ()
 Get the current config data instance.
json getScriptingValue (const std::string &key) const
void setScriptingValue (const std::string &key, const json &value)
json getScriptingConfigsCopy () const
void reloadScriptingConfigs ()
std::string getScriptingJson (const std::string &key) const
void setScriptingJson (const std::string &key, const std::string &json_value)
std::string configsScriptingJson () const

Detailed Description

Manages application settings.

Constructor & Destructor Documentation

◆ MbKVStore()

mb::MbKVStore::MbKVStore ( MantisBase & app)
explicit

Construct the settings store bound to an application.

Parameters
appOwning application (db + router access). Stored by reference and must outlive this store.

Member Function Documentation

◆ configs()

json & mb::MbKVStore::configs ( )

Get the current config data instance.

Returns
Config data as a JSON object

◆ configsScriptingJson()

std::string mb::MbKVStore::configsScriptingJson ( ) const
nodiscard

◆ getScriptingConfigsCopy()

json mb::MbKVStore::getScriptingConfigsCopy ( ) const
nodiscard

Return a copy of current configs (scripting). SMTP passwords are redacted.

◆ getScriptingJson()

std::string mb::MbKVStore::getScriptingJson ( const std::string & key) const
nodiscard

◆ getScriptingValue()

json mb::MbKVStore::getScriptingValue ( const std::string & key) const
nodiscard

Read a top-level config key (scripting). Returns null json when missing. smtp.password is returned as "********" when a password is stored.

◆ migrate()

void mb::MbKVStore::migrate ( )

Initialize migration, create base data for setting fields.

◆ reloadScriptingConfigs()

void mb::MbKVStore::reloadScriptingConfigs ( )

Reload configs from the database and apply them to the mailer.

◆ setScriptingJson()

void mb::MbKVStore::setScriptingJson ( const std::string & key,
const std::string & json_value )

◆ setScriptingValue()

void mb::MbKVStore::setScriptingValue ( const std::string & key,
const json & value )

Patch a top-level config key, persist it, and apply it. SMTP updates take effect on the mailer immediately. Pass "********" for smtp.password to keep the stored password.

◆ setupRoutes()

bool mb::MbKVStore::setupRoutes ( )

Initialize and set up routes for fetching settings data.

Returns
true if setting up routes succeeded.

The documentation for this class was generated from the following files:
  • /home/runner/work/mantisbase/mantisbase/include/mantisbase/core/kv_store.h
  • /home/runner/work/mantisbase/mantisbase/src/core/kv_store.cpp