matrix-org / synapse-s3-storage-provider

Synapse storage provider to fetch and store media in Amazon S3
Apache License 2.0
118 stars 33 forks source link

Add support for synapse running on sqlite3 database in `scripts/s3_media_upload` #71

Closed Alexis211 closed 2 years ago

Alexis211 commented 2 years ago

As the title says, this PR makes the s3_media_upload script able to run against a homeserver that runs on an sqlite3 database.

The database.yaml file is now expected to be as follows for an sqlite database:

sqlite:
  database: /path/to/homeserver.db

For a postgresql, the new syntax is:

postgres:
  user: pguser
  password: pgpass
  database: pgdb
  host: pghost
  port: pgport

However the old syntax is also still suported so as not to break compatibility:

user: pguser
password: pgpass
database: pgdb
host: pghost
port: pgport
Alexis211 commented 2 years ago

Thanks for your quick answer @squahtx . I factorized the code as you suggested and added a sign-off to the commit message.

squahtx commented 2 years ago

CI seems to be failing. Could you run the linter over your change (black scripts/s3_media_upload) ?

Alexis211 commented 2 years ago

Hi @squahtx , I ran the linter, hope things are OK now.

squahtx commented 2 years ago

CI still looks unhappy unfortunately.

Your version of black seems to be different to the one used in CI, and it's introduced some formatting changes to unrelated code.

Could you reset back to 772481b and make sure you're on black==19.10b0 (as specified in tox.ini)?

(For future reference, the Synapse team prefers to avoid force pushing once the review process has started. All PRs get squash merged at the end.)

Alexis211 commented 2 years ago

Here is a version formatted with black==19.10b0.

Sorry for force-pushing, I wasn't aware of the practices of the Synapse team. Will know for next time :)

squahtx commented 2 years ago

Thank you! Do you mind undoing the changes to unrelated code that the newer version of black did?

Alexis211 commented 2 years ago

Here we are :)

squahtx commented 2 years ago

Thank you for contributing! I hope that wasn't too much trouble!

Alexis211 commented 2 years ago

It's fine, don't worry! Thanks for your time and sorry for not following the sumbission guidelines in the first place.