4 Commits

Author SHA1 Message Date
dea6b928e1 🗃️ 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).
2023-01-22 19:02:54 +01:00
76d4c8a641 🚚 Rename backend project (idfm-matrix-widget -> carrramba-encore-rate)
Update the pyproject.toml file.
2023-01-22 19:01:15 +01:00
7423511a51 🚚 Rename backend component (idfm_matrix_backend -> backend) 2023-01-22 18:58:47 +01:00
c81d234426 🙈 Add __pycache__ and lock files 2023-01-22 17:25:44 +01:00
20 changed files with 15 additions and 13 deletions

3
backend/.gitignore vendored
View File

@@ -1 +1,2 @@
!**/__pycache__/
**/__pycache__/
poetry.lock

View File

@@ -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

View File

@@ -8,10 +8,10 @@ from fastapi.responses import JSONResponse
from fastapi.staticfiles import StaticFiles
from rich import print
from idfm_matrix_backend.db import db
from idfm_matrix_backend.idfm_interface import IdfmInterface
from idfm_matrix_backend.models import Line, Stop, StopArea
from idfm_matrix_backend.schemas import (
from backend.db import db
from backend.idfm_interface import IdfmInterface
from backend.models import Line, Stop, StopArea
from backend.schemas import (
Line as LineSchema,
TransportMode,
NextPassage as NextPassageSchema,
@@ -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()

View File

@@ -1,10 +1,10 @@
[tool.poetry]
name = "idfm-matrix-widget"
name = "carrramba-encore-rate"
version = "0.1.0"
description = ""
authors = ["Adrien SUEUR <me@adrien.run>"]
readme = "README.md"
packages = [{include = "idfm_matrix_backend"}]
packages = [{include = "backend"}]
[tool.poetry.dependencies]
python = "^3.11"

1
frontend/.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules
dist
package-lock.json
pnpm-lock.yaml