From ba508512363cb54170f5c8b0e1f17469db980c44 Mon Sep 17 00:00:00 2001 From: Josh Pigford Date: Thu, 4 Jan 2024 13:18:39 -0600 Subject: [PATCH] Added read-only SQL setup --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 35915f5a..3bf21b67 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,32 @@ bin/dev And visit [http://localhost:5000](http://localhost:5000) +### Read-only user setup + +After you've set up the initial database, you need to create a read-only user for the AI to use. + +Eventually we should build a setup script to help with this, but for now you need to manually run the following SQL in your `maybe_ai_development` database: + +```sql +CREATE ROLE ai_user WITH LOGIN PASSWORD 'YOUR_UNIQUE_PASSWORD'; + +GRANT SELECT ON balances TO ai_user; +GRANT SELECT ON accounts TO ai_user; +GRANT SELECT ON connections TO ai_user; +GRANT SELECT ON conversations TO ai_user; +GRANT SELECT ON holdings TO ai_user; +GRANT SELECT ON investment_transactions TO ai_user; +GRANT SELECT ON messages TO ai_user; +GRANT SELECT ON metrics TO ai_user; +GRANT SELECT ON transactions TO ai_user; +``` + +Then, in your `.env` file you need to set the `READONLY_DATABASE_URL` to: + +``` +postgres://ai_user:YOUR_UNIQUE_PASSWORD@localhost/maybe_ai_development +``` + ## External Services Currently the app relies on a few external services: