aboutsummaryrefslogtreecommitdiff
path: root/inventory-service/app/core
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-17 18:16:35 +0200
committeralex <[email protected]>2026-07-17 18:16:35 +0200
commit8e796c9cfcd65f6225a6ae3ec2a4419f265b0ebc (patch)
tree1bf90385144be2e9f350c31da553b1ac306ee60b /inventory-service/app/core
parent5f6918db393ed78dd8f038e9e5f1ea85f811dc52 (diff)
downloadorder-inventory-system-8e796c9cfcd65f6225a6ae3ec2a4419f265b0ebc.tar.xz
order-inventory-system-8e796c9cfcd65f6225a6ae3ec2a4419f265b0ebc.zip
inventory-service initHEADmain
Diffstat (limited to 'inventory-service/app/core')
-rw-r--r--inventory-service/app/core/config.py19
-rw-r--r--inventory-service/app/core/database.py8
2 files changed, 27 insertions, 0 deletions
diff --git a/inventory-service/app/core/config.py b/inventory-service/app/core/config.py
new file mode 100644
index 0000000..df5526d
--- /dev/null
+++ b/inventory-service/app/core/config.py
@@ -0,0 +1,19 @@
+from pydantic_settings import BaseSettings
+
+
+class Settings(BaseSettings):
+ PROJECT_NAME: str = "Inventory Service"
+
+ DATABASE_URL: str
+
+ KAFKA_BOOTSTRAP_SERVERS: str = "localhost:9092"
+ KAFKA_CONSUMER_GROUP_ID: str = "inventory-service-group"
+ KAFKA_ORDERS_TOPIC: str = "orders"
+ KAFKA_INVENTORY_TOPIC: str = "inventory"
+
+ class Config:
+ env_file = ".env"
+ env_file_encoding = "utf-8"
+
+
+settings = Settings()
diff --git a/inventory-service/app/core/database.py b/inventory-service/app/core/database.py
new file mode 100644
index 0000000..3d8f1c9
--- /dev/null
+++ b/inventory-service/app/core/database.py
@@ -0,0 +1,8 @@
+from sqlalchemy import create_engine
+from sqlalchemy.orm import declarative_base, sessionmaker
+from app.core.config import settings
+
+engine = create_engine(settings.DATABASE_URL)
+SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
+
+Base = declarative_base()