diff --git a/src/lib/agent/subsystems/http/routes/status.mjs b/src/lib/agent/subsystems/http/routes/status.mjs index 55c0b42..0f9ed25 100644 --- a/src/lib/agent/subsystems/http/routes/status.mjs +++ b/src/lib/agent/subsystems/http/routes/status.mjs @@ -4,6 +4,7 @@ export default async function(sys, ctx, _next) { ctx.send.json(200, { version: `${sys.version}-${sys.commit.substring(0, 7)}`, // TODO: Implement a fancier check here - status: sys.listening ? "ok" : "not_listening" + status: sys.listening ? "ok" : "not_listening", + tables: sys.info.list_tables() }); } diff --git a/src/lib/core/InfoBroker.mjs b/src/lib/core/InfoBroker.mjs index 27a0030..e56098e 100644 --- a/src/lib/core/InfoBroker.mjs +++ b/src/lib/core/InfoBroker.mjs @@ -28,10 +28,23 @@ class InfoBroker { }; } + /** + * Determines if the given table name is valid or not. + * @param {string} name The table name to validate. + * @return {Boolean} Whether the table name is valid (true) or not (false). + */ is_valid_table(name) { return Object.keys(this.allowed_tables).includes(name); } + /** + * Returns a list of known table names. + * @return {string[]} A list of known table names. + */ + list_tables() { + return Object.keys(this.allowed_tables); + } + async make_table_meta() { return { version: `${this.sysquery.version}-${this.sysquery.commit.substring(0, 7)}`,