"""Traitlets-based configuration for the snapshot server extension.""" import os from traitlets.config.configurable import Configurable from traitlets.traitlets import Bool, Unicode, default class SnapshotConfig(Configurable): """Configuration options for the notebook snapshot extension.""" storage_type = Unicode( "local", config=True, help='Storage backend type. Either "local" or "s3" (covers AWS S3, MinIO, etc.).', ) local_root = Unicode( "", config=True, help="Directory for local snapshot storage. Empty means /.notebook_versions.", ) s3_endpoint = Unicode( "", config=True, help="S3 endpoint host (without scheme), e.g. localhost:9000 for MinIO or s3.us-east-1.amazonaws.com for AWS S3.", ) @default("s3_endpoint") def _default_s3_endpoint(self): """Default to the ``S3_ENDPOINT`` environment variable.""" return os.environ.get("S3_ENDPOINT", "") s3_access_key = Unicode( "", config=True, help="S3 access key ID.", ) @default("s3_access_key") def _default_s3_access_key(self): """Default to the ``S3_ACCESS_KEY`` environment variable.""" return os.environ.get("S3_ACCESS_KEY", "") s3_secret_key = Unicode( "", config=True, help="S3 secret access key.", ) @default("s3_secret_key") def _default_s3_secret_key(self): """Default to the ``S3_SECRET_KEY`` environment variable.""" return os.environ.get("S3_SECRET_KEY", "") s3_bucket = Unicode( "notebook-snapshot", config=True, help="S3 bucket name. Created automatically if it does not exist.", ) s3_secure = Bool( False, config=True, help="Use HTTPS for the S3 connection.", ) s3_prefix = Unicode( "", config=True, help="Optional prefix prepended to all object keys in the S3 bucket.", )