From 5d2986e897d8aff39437377dba02c508cf528749 Mon Sep 17 00:00:00 2001 From: Helena Adamkova <58051865+Ellenn-A@users.noreply.github.com> Date: Mon, 20 May 2024 15:07:40 +0100 Subject: [PATCH] comments & config --- Dockerfile | 1 - app/core/config.py | 11 +++++++++++ app/routes/posts.py | 5 +++-- 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 app/core/config.py diff --git a/Dockerfile b/Dockerfile index 1afb0b4..c4c9e49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM python:3.12-slim LABEL MAINTAINER Digital Catapult -# LABEL org.opencontainers.image.source=https://github.com/CDECatapult/soniclabs-resultsmanager WORKDIR /app diff --git a/app/core/config.py b/app/core/config.py new file mode 100644 index 0000000..065339e --- /dev/null +++ b/app/core/config.py @@ -0,0 +1,11 @@ +import os + +from pydantic import BaseSettings + + +class AppSettings(BaseSettings): + VERITABLE_URL: str = os.getenv("VERITABLE_URL", "http://localhost:3010") + PEER_URL: str = os.getenv("PEER_URL", "http://localhost:3001/api") + + +settings = AppSettings() \ No newline at end of file diff --git a/app/routes/posts.py b/app/routes/posts.py index 041ce0e..b286fd4 100644 --- a/app/routes/posts.py +++ b/app/routes/posts.py @@ -3,13 +3,14 @@ from typing import Any, List, Optional import httpx +from core.config import settings from fastapi import APIRouter, HTTPException from fastapi.responses import JSONResponse from pydantic import BaseModel from uagents import Model -veritableUrl = "http://localhost:3010" -peerUrl = "http://localhost:3001/api" +veritableUrl = settings.VERITABLE_URL +peerUrl = settings.PEER_URL class Query(BaseModel):