clipboard
This commit is contained in:
@@ -5,6 +5,8 @@ BASE_DIR = Path(__file__).resolve().parent
|
||||
SECRET_FILE = BASE_DIR / ".secret_key"
|
||||
|
||||
DEFAULT_SENSORS_PORT = 8001
|
||||
DEFAULT_CLIPBOARD_MAX_FILE_BYTES = 100 * 1024 * 1024
|
||||
DEFAULT_CLIPBOARD_MAX_TOTAL_BYTES = 1024 * 1024 * 1024
|
||||
|
||||
|
||||
def load_secret_key() -> str:
|
||||
@@ -43,3 +45,27 @@ def sensors_api_url() -> str:
|
||||
if configured:
|
||||
return configured.rstrip("/")
|
||||
return f"http://localhost:{DEFAULT_SENSORS_PORT}"
|
||||
|
||||
|
||||
def clipboard_dir() -> Path:
|
||||
"""Directory where uploaded clipboard files are stored."""
|
||||
configured = os.environ.get("CLIPBOARD_DIR")
|
||||
if configured:
|
||||
return Path(configured).expanduser().resolve()
|
||||
return BASE_DIR / "clipboard"
|
||||
|
||||
|
||||
def clipboard_max_file_bytes() -> int:
|
||||
return int(
|
||||
os.environ.get(
|
||||
"CLIPBOARD_MAX_FILE_BYTES", DEFAULT_CLIPBOARD_MAX_FILE_BYTES
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def clipboard_max_total_bytes() -> int:
|
||||
return int(
|
||||
os.environ.get(
|
||||
"CLIPBOARD_MAX_TOTAL_BYTES", DEFAULT_CLIPBOARD_MAX_TOTAL_BYTES
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user