diff --git a/.env b/.env deleted file mode 100644 index 3366f86..0000000 --- a/.env +++ /dev/null @@ -1,8 +0,0 @@ -# Domain -# Will be set to the prod domain with an env var on deployment used by Traefik -# to transmit traffic and acquire TLS certs -ENVIRONMENT=local -PROJECT_NAME="CMT" - -# DB URI -DATABASE_URI=mysql+mysqldb://admin:Avatarme1@localhost:3306/CMT diff --git a/.gitignore b/.gitignore index 417bbf0..c1cd679 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ **/__pycache__ **/.pytest_cache +**/venv +**/.env diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..68d96d1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "github.copilot.advanced": { + "ignore": [ + "**/.env", + "**/.env.*", + "**/secrets/**", + "**/*.key", + "**/*.pem" + ] + } +} diff --git a/README.md b/README.md index 6faa159..6110257 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,36 @@ # CMT +### Starting the application +```bash +cd backend +fastapi run --reload app/main.py +``` ### DB +MySQL ```sql --- db setup +-- MySQL db setup cat db_setup.sql | mysql -u root -p -- table setup cat db_table_setup.sql | mysql -u admin -p CMT ``` +Postgresql +```bash +# Installation - Arch +sudo pacman -Syu postgresql +# Initialising db cluster +sudo -u postgres initdb -D /var/lib/postgres/data + +# enable + start service +sudo systemctl enable --now postgresql + +# Creating user +sudo -u postgres createuser -P appuser +# Creating db owned by this user +sudo -u postgres createdb -O appuser db_name + +# Test +psql "postgresql://appuser:secret@localhost:5432/appdb" +``` ### Testing ``` cd backend diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 54d4eec..bee25dd 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -1,5 +1,5 @@ from pydantic import ( - MySQLDsn + PostgresDsn ) from pydantic_settings import BaseSettings, SettingsConfigDict @@ -7,7 +7,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): """ """ - database_uri: MySQLDsn + database_uri: PostgresDsn environment: str project_name: str