Flask Framework issues
I was trying to get a Flask server running w/ pyfed and was ran into a few issues it looks like it was last updated 7 months ago so it's probably a bit behind (https://dev.funkwhale.audio/funkwhale/pyfed/-/blob/main/src/pyfed/integration/frameworks/flask.py)
I ran into #4 initially, that was fixed by just swapping the database url to database_url=self.config.storage.database.url
but then it didn't recognize any storage backends that I tried. I found this documentation https://dev.funkwhale.audio/funkwhale/pyfed/-/blob/main/documentation/guides/basic-server.md, which also might be outdated because from pyfed import Server
wasn't finding the Server class, so I couldn't figure out how to setup the storage.
I had to change a few other lines in that flask.py initialize() method to even get it to run
security.keys_path
was odd, because some of the files referenced it as 'key_path', the config (https://dev.funkwhale.audio/funkwhale/pyfed/-/blob/main/src/pyfed/config.py) in particular wouldn't read the config.yaml correctly until I modified it to
@dataclass
class SecurityConfig:
"""Security configuration."""
domain: str
keys_path: str # Changed this line from key_path
private_key_path: Optional[str] = None
public_key_path: Optional[str] = None
signature_ttl: int = 300 # 5 minutes
max_payload_size: int = 5_000_000 # 5MB
allowed_algorithms: List[str] = field(default_factory=lambda: ["rsa-sha256"])
flask.py initialize() method, had to change the Key manager configuration and add a InstanceDiscovery instance.
...
self.key_manager = KeyManager(self.config.domain, self.config.security.keys_path)
await self.key_manager.initialize()
discovery = InstanceDiscovery()
await discovery.initialize()
self.delivery = ActivityDelivery(
key_manager=self.key_manager,
discovery=discovery
)
#await self.delivery.initialize()
# Initialize middleware
self.middleware = ActivityPubMiddleware(
signature_verifier = HTTPSignatureVerifier(key_manager=self.key_manager),
rate_limiter=self.delivery.rate_limiter
)
...
Eventually, I did get it to run, though I haven't figured out how to setup the storage backend yet.
Anyways, sorry for the drawn out introduction, I was wondering if I should even bother working with the existing Flask implementation? Or are you still making some major changes to how that works and I should just wait for a future release? Or am I just looking at incorrect docs and I should be looking elsewhere?
I could also separate this into a few different issues if that would be useful to you.
Thanks for the help!