🗃️ Create and use a db dedicated user for backend
* Rename the db name (idfm_matrix_bot -> cer_db). * Remove unused bot database. * Create a dedicated user (cer_user/cer_password).
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
set -e
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||
CREATE USER idfm_matrix_bot;
|
||||
CREATE DATABASE bot;
|
||||
CREATE DATABASE idfm;
|
||||
GRANT ALL PRIVILEGES ON DATABASE bot TO idfm_matrix_bot;
|
||||
GRANT ALL PRIVILEGES ON DATABASE idfm TO idfm_matrix_bot;
|
||||
CREATE USER cer_user WITH ENCRYPTED password 'cer_password';
|
||||
CREATE DATABASE cer_db;
|
||||
\c cer_db;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm SCHEMA "public";
|
||||
GRANT CREATE ON SCHEMA public to cer_user;
|
||||
EOSQL
|
||||
|
||||
|
@@ -24,7 +24,7 @@ API_KEY = environ.get("API_KEY")
|
||||
# TODO: Add error message if no key is given.
|
||||
|
||||
# TODO: Remove postgresql+asyncpg from environ variable
|
||||
DB_PATH = "postgresql+asyncpg://postgres:postgres@127.0.0.1:5438/idfm"
|
||||
DB_PATH = "postgresql+asyncpg://cer_user:cer_password@127.0.0.1:5438/cer_db"
|
||||
|
||||
|
||||
app = FastAPI()
|
||||
|
Reference in New Issue
Block a user