summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/config.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/config.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/config.py b/packages/meshbay-node/src/meshbay_node/config.py
index c0326f0..8372e5c 100644
--- a/packages/meshbay-node/src/meshbay_node/config.py
+++ b/packages/meshbay-node/src/meshbay_node/config.py
@@ -70,6 +70,10 @@ quic_port = 19010
# and its files stay in the index,
# rather than looking deleted
+# upload_dir: a separate directory for uploads. Files land directly in it,
+# not in an "uploads" subdirectory. It appears as its own root in the index.
+# upload_dir = "/home/user/Incoming"
+
# The single-directory form still works and means the same thing — one root,
# named after the directory, receiving uploads.
[[groups]]
@@ -125,6 +129,7 @@ class RootSpec:
name: str = "" # empty → the directory's basename, derived at load
kind: str = "generic" # generic|video|audio|photo — a view hint, unused for now
upload: bool = False # exactly one root per group receives uploads
+ direct: bool = False # uploads land at root path, not in a subdirectory
@dataclass
@@ -137,6 +142,7 @@ class GroupConfig:
# unprefixed shape.
roots: list[RootSpec] = field(default_factory=list)
shared_dir: str = "" # legacy single-root form, migrated at load
+ upload_dir: str = "" # separate filesystem path for uploads
visibility: str = "private" # public|private — discoverability, not admission
# Admission. "invite" (default) means a newcomer needs a one-time pairing code
# before the node wraps the group key for them; "open" means the node pins
@@ -160,6 +166,11 @@ class GroupConfig:
"""
if not self.roots and self.shared_dir.strip():
self.roots = [RootSpec(path=self.shared_dir.strip(), upload=True)]
+ if self.upload_dir.strip():
+ for r in self.roots:
+ r.upload = False
+ self.roots.append(RootSpec(
+ path=self.upload_dir.strip(), upload=True, direct=True))
@dataclass
@@ -275,6 +286,7 @@ def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config:
# Ignored when roots are given explicitly (warned about in
# _read_roots); otherwise __post_init__ migrates it.
shared_dir="" if _read_roots(g) else g.get("shared_dir", ""),
+ upload_dir=g.get("upload_dir", ""),
visibility=g.get("visibility", "private"),
join_policy=g.get("join_policy", "invite"),
quic_port=g.get("quic_port", cfg.node.quic_port),