summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/db/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/db/models.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/db/models.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/db/models.py b/packages/meshbay-hub/src/meshbay_hub/db/models.py
index 3966bdc..0c337c1 100644
--- a/packages/meshbay-hub/src/meshbay_hub/db/models.py
+++ b/packages/meshbay-hub/src/meshbay_hub/db/models.py
@@ -299,6 +299,26 @@ class UserPreference(Base):
value: Mapped[str] = mapped_column(Text, nullable=False)
+class HubSetting(Base):
+ """
+ Instance-wide settings an admin changes at runtime from the panel.
+
+ Deliberately a key/value table rather than fields in `hub.toml`: the config
+ file is read once at boot and editing it means an SSH session and a restart,
+ which is not what "toggle this from the admin page" means. Anything here is a
+ policy the running hub can change on itself.
+
+ Absent key ⇒ the built-in default (see `meshbay_hub.hub_settings`). An older
+ hub with no row behaves exactly as it did before the setting existed.
+ """
+ __tablename__ = "hub_settings"
+
+ key: Mapped[str] = mapped_column(String(64), primary_key=True)
+ value: Mapped[str] = mapped_column(Text, nullable=False)
+ updated_at: Mapped[datetime] = mapped_column(
+ DateTime(timezone=True), default=_now, onupdate=_now)
+
+
class IPLog(Base):
"""
Connection log for legal compliance.