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 set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER idfm_matrix_bot; CREATE USER cer_user WITH ENCRYPTED password 'cer_password';
CREATE DATABASE bot; CREATE DATABASE cer_db;
CREATE DATABASE idfm; \c cer_db;
GRANT ALL PRIVILEGES ON DATABASE bot TO idfm_matrix_bot; CREATE EXTENSION IF NOT EXISTS pg_trgm SCHEMA "public";
GRANT ALL PRIVILEGES ON DATABASE idfm TO idfm_matrix_bot; GRANT CREATE ON SCHEMA public to cer_user;
EOSQL EOSQL

View File

@@ -8,10 +8,10 @@ from fastapi.responses import JSONResponse
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from rich import print from rich import print
from idfm_matrix_backend.db import db from backend.db import db
from idfm_matrix_backend.idfm_interface import IdfmInterface from backend.idfm_interface import IdfmInterface
from idfm_matrix_backend.models import Line, Stop, StopArea from backend.models import Line, Stop, StopArea
from idfm_matrix_backend.schemas import ( from backend.schemas import (
Line as LineSchema, Line as LineSchema,
TransportMode, TransportMode,
NextPassage as NextPassageSchema, NextPassage as NextPassageSchema,
@@ -24,7 +24,7 @@ API_KEY = environ.get("API_KEY")
# TODO: Add error message if no key is given. # TODO: Add error message if no key is given.
# TODO: Remove postgresql+asyncpg from environ variable # 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() app = FastAPI()

View File

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

1
frontend/.gitignore vendored
View File

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