Commit 7746ea34 authored by arun.uday's avatar arun.uday

AssetManager-V1.0- Not yet reviewed

Deleted conf file and added values to .env file
parent c38bd079
...@@ -2,3 +2,8 @@ MONGO_URI=mongodb://localhost:27017 ...@@ -2,3 +2,8 @@ MONGO_URI=mongodb://localhost:27017
DB_NAME=userDB DB_NAME=userDB
SERVICE_HOST=0.0.0.0 SERVICE_HOST=0.0.0.0
SERVICE_PORT=8671 SERVICE_PORT=8671
PROJECT_NAME = AssetManager
PROJECT_ID = 1256
base_path = scripts/
sub_path = log/
ENCODING_TYPE = utf-8
\ No newline at end of file
[PROJECT_DETAILS]
PROJECT_NAME = AssetManager
PROJECT_ID = 1256
[PATH]
base_path = scripts/
sub_path = log/
[ENCODING]
ENCODING_TYPE = utf-8
\ No newline at end of file
import configparser
import pathlib import pathlib
from typing import Literal from typing import Literal
from pydantic import BaseSettings, Field from pydantic import BaseSettings, Field
config = configparser.RawConfigParser()
config.read("conf/application.conf")
class _Services(BaseSettings): class _Services(BaseSettings):
HOST: str = Field(default="127.0.0.1", env="service_host") HOST: str = Field(default="127.0.0.1", env="service_host")
PORT: int = Field(default=8000, env="service_port") PORT: int = Field(default=8000, env="service_port")
PROJECT_NAME = config.get("PROJECT_DETAILS", "PROJECT_NAME") PROJECT_NAME = Field(default="AssetManager", env="project_name")
PROJECT_ID = config.get("PROJECT_DETAILS", "PROJECT_ID") PROJECT_ID = Field(default="1256", env="project_id")
ENCODING_TYPE = config.get("ENCODING", "ENCODING_TYPE") ENCODING_TYPE = Field(default="utf-8", env="encoding_type")
ENABLE_CORS: bool = True ENABLE_CORS: bool = True
CORS_URLS: list[str] = ["*.ilens.io"] CORS_URLS: list[str] = ["*.ilens.io"]
CORS_ALLOW_CREDENTIALS: bool = True CORS_ALLOW_CREDENTIALS: bool = True
......
2023-03-20 14:32:44 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671 2023-03-20 14:32:44 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
2023-03-20 14:39:15 - INFO - [MainThread:<module>(): 37] - App Starting at 0.0.0.0:8671
...@@ -27,7 +27,7 @@ def get_logger(): ...@@ -27,7 +27,7 @@ def get_logger():
# creating the folder if not exist # creating the folder if not exist
if not os.path.exists(file_path): if not os.path.exists(file_path):
os.makedirs(file_path) os.makedirs(file_path)
# joining the path # joining the path
log_file = os.path.join(f"{file_path}/{Services.PROJECT_NAME}log.log") log_file = os.path.join(f"{file_path}/{Services.PROJECT_NAME}log.log")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment