the Postgres storage assumes that if a database exists, the wallet is already initialized.
If it doesn't, it uses the adminAccount/adminPassword to create the database and instantiate the schema.
This is fine when using a self-managed PostgreSQL server but doesn't work well with AWS/RDS.
AWS/RDS does not support urls of the form: PostgreSQL://account:password@host:port/postgres
Fortunately in our case, there seems to be a bug where if the database doesn't exist, and adminAccount/adminPassword are not provided, the storage will create the database using the regular account/password.
But this only happens because our security level is currently weak, and our app is provided with the admin account/password.
In a more solid implementation, the database should be created upfront, together with various accounts with limited privileges.
If that matters, I'm happy to provide detailed specifications, where:
a wallet is considered initialized if the db exists AND the tables have been created
the config supports 3 accounts with more granular privileges (create db, create schema, use schema)
My rust is very Rusty, so not sure I can go as far as submitting a PR.
Hi,
the Postgres storage assumes that if a database exists, the wallet is already initialized. If it doesn't, it uses the adminAccount/adminPassword to create the database and instantiate the schema. This is fine when using a self-managed PostgreSQL server but doesn't work well with AWS/RDS. AWS/RDS does not support urls of the form: PostgreSQL://account:password@host:port/postgres Fortunately in our case, there seems to be a bug where if the database doesn't exist, and adminAccount/adminPassword are not provided, the storage will create the database using the regular account/password. But this only happens because our security level is currently weak, and our app is provided with the admin account/password. In a more solid implementation, the database should be created upfront, together with various accounts with limited privileges. If that matters, I'm happy to provide detailed specifications, where: