|
| | ~MantisBase () |
| |
| | MantisBase (const MantisBase &)=delete |
| |
| MantisBase & | operator= (const MantisBase &)=delete |
| |
| | MantisBase (MantisBase &&)=delete |
| |
| MantisBase & | operator= (MantisBase &&)=delete |
| |
| int | run () |
| | Start the http server and start listening for requests.
|
| |
| void | close () |
| | Close the application and reset object instances that are dependent on the class.
|
| |
| int | port () const |
| | Retrieve HTTP Listening port.
|
| |
| void | setPort (const int &port) |
| | Set a new port value for HTTP server.
|
| |
| int | poolSize () const |
| | Retrieve the database pool size value.
|
| |
| std::string | host () const |
| | Retrieve HTTP Server host address. For instance, a host of 127.0.0.1, 0.0.0.0, etc.
|
| |
| void | setHost (const std::string &host) |
| | Update HTTP Server host address.
|
| |
| std::string | publicDir () const |
| | Retrieve the public static file directory.
|
| |
| void | setPublicDir (const std::string &dir) |
| | Update HTTP server static file directory.
|
| |
| std::string | dataDir () const |
| | Retrieves the data directory where SQLite db and files are stored.
|
| |
| void | setDataDir (const std::string &dir) |
| | Update the data directory for MantisApp.
|
| |
| std::string | scriptsDir () const |
| | Retrieves the scripts directory where JavaScript files are stored used for extending functionality in Mantis.
|
| |
| void | setScriptsDir (const std::string &dir) |
| | Update the scripts directory for MantisApp.
|
| |
| std::string | dbType () const |
| | Retrieves the active database type.
|
| |
| void | setDbType (const std::string &dbType) |
| |
| Database & | db () const |
| | Get the database unit object.
|
| |
| argparse::ArgumentParser & | cmd () const |
| | Get the commandline parser object.
|
| |
| Router & | router () const |
| | Get the router object instance.
|
| |
| KeyValStore & | settings () const |
| | Get the KeyValue unit object.
|
| |
| Logger & | logs () const |
| | Get the logs unit object.
|
| |
| RealtimeDB & | rt () const |
| | Get the realtime unit (SQLite/PostgreSQL change detection for SSE /api/v1/realtime).
|
| |
| Entity | entity (const std::string &entity_name) const |
| | Fetch a table schema encapsulated by an Entity object from given the table name. If table does not exist yet, return an emty object.
|
| |
| bool | hasEntity (const std::string &entity_name) const |
| | Check if table schema encapsulated by an Entity object from given the table name exists. If table does not exist yet, return false.
|
| |
| duk_context * | ctx () const |
| | Get the duktape context.
|
| |
| void | openBrowserOnStart () const |
| | Launch browser with the admin dashboard page. If all goes well, the default OS browser should open (if not opened) with the admin dashboard URL.
|
| |
| std::chrono::time_point< std::chrono::steady_clock > | startTime () const |
| | Get the server start time in std::chrono::
|
| |
| bool | isDevMode () const |
| |
MantisBase entry point.
This class handles the entrypoint to the Mantis world, where we can set/get application flags and variables, as well as access other application units. These units are:
- DatabaseMgr: For all database handling,
- See also
- DatabaseMgr for more information.
- HttpMgr: Low-level http server operation and routing.
- See also
- HttpMgr for low-level access or
-
RouterMgr for a high level routing methods.
- LogsMgr: For logging capabilities,
- See also
- LoggingMgr for more details.
- RouterMgr: High level routing wrapper on top of
- See also
- HttpMgr,
-
RouterMgr for more details.
- ValidatorMgr: A validation store using regex,
- See also
- Validator for more details.
| MantisBase & mb::MantisBase::create |
( |
const json & |
config = json::object() | ) |
|
|
static |
Convenience function to allow creating class instance given the values needed to set up the app without any need for passing in cmd args.
The expected values are: { "database": "<db type>", "connection": "<connection string>", "dataDir": "<path to dir>", "publicDir": "<path to dir>", "scriptsDir": "<path to dir>", "dev": true, "serve": { "port": <int>, "host": "<host IP/addr>", "poolSize": <int>, }, "admins": { "add": "<email to add>", "rm": "<email to remove>" } }
- Note
- All primary options above are optional, you can omit to use default values.
-
admins subcommand expects a subcommand with either the add or rm.
-
serve command can have an empty json object and the app will configure with defaults.
json arg1 = json::object();
auto& app1 = MantisApp::create(arg2);
arg2["database"] = "PSQL";
arg2["database"] = "dbname=mantis username=postgres password=12342532";
arg2["dev"] = true;
arg2["serve"] = json::object{};
auto& app2 = MantisApp::create(arg2);
nlohmann::json json
Shorten JSON namespace.
Definition context_store.h:18
- Parameters
-
| config | JSON Object bearing the cmd args values to be used |
- Returns
- A reference to the created class instance