get_tenant_info = async (subdomain) => {
  const saneDomain = domain_sanitize(subdomain);

  let info = {};

  // get tenant row
  const ten = await Tenant.findOne({ subdomain: saneDomain });
  if (ten) {
    //info.ten = ten;
    info.description = ten.description;
    info.created = ten.created;
    info.template = ten.template;
    info.email = ten.email;
  }

  // get data from tenant schema
  return await db.runWithTenant(saneDomain, async () => {
    // TBD fix the first user issue because not always firt user by id is creator of tenant
    const firstUser = await User.find({}, { orderBy: "id", limit: 1 });
    if (firstUser && firstUser.length > 0) {
      info.first_user_email = firstUser[0].email;
    }
    // todo sort in alphabet order
    // config items count
    info.nconfigs = await db.count("_sc_config");
    // error messages count
    info.nerrors = await db.count("_sc_errors");
    // event log
    info.nevent_log = await db.count("_sc_event_log");
    // users count
    info.nusers = await db.count("users");
    // roles count
    info.nroles = await db.count("_sc_roles");
    // table_constraints count
    info.ntable_constraints = await db.count("_sc_table_constraints");
    // tables count
    info.ntables = await db.count("_sc_tables");
    // table fields count
    info.nfields = await db.count("_sc_fields");
    // views count
    info.nviews = await db.count("_sc_views");
    // files count
    info.nfiles = await db.count("_sc_files");
    // pages count
    info.npages = await db.count("_sc_pages");
    // triggers (actions) count
    info.nactions = await db.count("_sc_triggers");
    // plugins count
    info.nplugins = await db.count("_sc_plugins");
    // migration count
    info.nmigrations = await db.count("_sc_migrations");
    // library count
    info.nlibrary = await db.count("_sc_library");
    // notifications
    info.nnotifications = await db.count("_sc_notifications");
    // tags
    info.ntags = await db.count("_sc_tags");
    // tag_entries
    info.ntag_entries = await db.count("_sc_tag_entries");
    // snapshots
    info.nsnapshots = await db.count("_sc_snapshots");
    // session - Only for main app?
    //info.nsession = await db.count("_sc_session");

    // base url
    info.base_url = await getConfig("base_url");
    return info;
  });
}
Get Tenant info
@param {string} subdomain
@returns {Promise<*>}