mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 13:29:56 +02:00
fix: adding new service for notification handling
This commit is contained in:
0
notifier/Dockerfile.notifier
Normal file
0
notifier/Dockerfile.notifier
Normal file
0
notifier/README.md
Normal file
0
notifier/README.md
Normal file
1
notifier/engine/api/__init__.py
Normal file
1
notifier/engine/api/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .home import router as home_router
|
||||
9
notifier/engine/api/home.py
Normal file
9
notifier/engine/api/home.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def home():
|
||||
return {"message": "Hello, World!"}
|
||||
11
notifier/engine/app.py
Normal file
11
notifier/engine/app.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from fastapi import FastAPI
|
||||
from .api import home_router
|
||||
from .settings import settings
|
||||
|
||||
app = FastAPI(
|
||||
title=settings.PROJECT_NAME,
|
||||
description=settings.PROJECT_DESCRIPTION,
|
||||
version=settings.PROJECT_VERSION,
|
||||
)
|
||||
|
||||
app.include_router(home_router, tags=["home"])
|
||||
4
notifier/engine/celery.py
Normal file
4
notifier/engine/celery.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from celery import Celery
|
||||
from .settings import settings
|
||||
|
||||
celery = Celery("tasks", broker=settings.CELERY_BROKER_URL)
|
||||
3
notifier/engine/settings/__init__.py
Normal file
3
notifier/engine/settings/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from common import Settings
|
||||
|
||||
settings = Settings()
|
||||
10
notifier/engine/settings/celery.py
Normal file
10
notifier/engine/settings/celery.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
|
||||
|
||||
class CelerySettings:
|
||||
BROKER_URL = os.environ.get("CELERY_BROKER_URL", "redis://localhost:6379/0")
|
||||
CELERY_ACCEPT_CONTENT = ["json"]
|
||||
CELERY_TASK_SERIALIZER = "json"
|
||||
CELERY_RESULT_SERIALIZER = "json"
|
||||
CELERY_TIMEZONE = "UTC"
|
||||
CELERY_ENABLE_UTC = True
|
||||
16
notifier/engine/settings/common.py
Normal file
16
notifier/engine/settings/common.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
|
||||
# third-party imports
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
# local imports
|
||||
from .celery import CelerySettings
|
||||
from .postgres import PostgresSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings, CelerySettings, PostgresSettings):
|
||||
PROJECT_NAME: str = "Notification Engine"
|
||||
PROJECT_DESCRIPTION: str = "A simple notification service"
|
||||
PROJECT_VERSION: str = "0.1.0"
|
||||
SECRET_KEY: str = os.environ.get("SECRET_KEY", "123456789")
|
||||
DEBUG: bool = os.environ.get("DEBUG", False)
|
||||
9
notifier/engine/settings/postgres.py
Normal file
9
notifier/engine/settings/postgres.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import os
|
||||
|
||||
|
||||
class PostgresSettings:
|
||||
PG_HOST: str = os.environ.get("POSTGRES_HOST", "localhost")
|
||||
PG_PORT: int = os.environ.get("POSTGRES_PORT", 5432)
|
||||
PG_USER: str = os.environ.get("POSTGRES_USER", "postgres")
|
||||
PG_PASSWORD: str = os.environ.get("POSTGRES_PASSWORD", "postgres")
|
||||
PG_NAME: str = os.environ.get("POSTGRES_DB", "notification")
|
||||
0
notifier/engine/tasks/__init__.py
Normal file
0
notifier/engine/tasks/__init__.py
Normal file
6
notifier/main.py
Normal file
6
notifier/main.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from .engine.app import app
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(app, host="0.0.0.0", port=8080)
|
||||
2
notifier/requirements.txt
Normal file
2
notifier/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
fastapi==0.111.1
|
||||
pydantic==2.8.2
|
||||
Reference in New Issue
Block a user