rugs icon indicating copy to clipboard operation
rugs copied to clipboard

Add support for arbirary database connection string

Open ColdenCullen opened this issue 1 year ago • 6 comments

It would be nice to be able to pass DATABASE_URL as an environment variable to the docker container in order to use an external database for enhanced robustness. This would allow us to run this tool in the cloud without requiring any on-disk persistence.

It seems like this should be possible by:

  1. Replace usages of sqlx::SqlitePool with sqlx::AnyPool
  2. Refactor the --database parameter to accept the full connection string, not just the part after sqlite:
  3. Add an ENV entry to the Dockerfile to set a default and allow for overrides

I gave it a shot locally, but I don't know enough about sqlx to make the swap. I ran into issues with the query_scalar macro returning a QueryScalar for the Sqlite driver and not the Any driver (I think this has to do with the files in the .sqlx folder?).

ColdenCullen avatar Aug 31 '23 20:08 ColdenCullen