Spaces:
Runtime error
Runtime error
Create config/settings.py
Browse files- config/settings.py +42 -0
config/settings.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# config/settings.py
|
| 2 |
+
import os
|
| 3 |
+
from typing import Optional
|
| 4 |
+
from pydantic import BaseSettings
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
|
| 7 |
+
load_dotenv()
|
| 8 |
+
|
| 9 |
+
class Settings(BaseSettings):
|
| 10 |
+
# Solana Configuration
|
| 11 |
+
SOLANA_RPC_URL: str = os.getenv("SOLANA_RPC_URL", "https://api.mainnet-beta.solana.com")
|
| 12 |
+
DIAMOND_TOKEN_ADDRESS: str = os.getenv("DIAMOND_TOKEN_ADDRESS", "5zJo2GzYRgiZw5j3SBNpuqVcGok35kT3ADwsw74yJWV6")
|
| 13 |
+
PLATFORM_PRIVATE_KEY: Optional[str] = os.getenv("PLATFORM_PRIVATE_KEY")
|
| 14 |
+
PLATFORM_PUBLIC_KEY: Optional[str] = os.getenv("PLATFORM_PUBLIC_KEY")
|
| 15 |
+
|
| 16 |
+
# Triton Configuration
|
| 17 |
+
TRITON_GRPC_URL: str = os.getenv("TRITON_GRPC_URL", "localhost:8001")
|
| 18 |
+
TRITON_HTTP_URL: str = os.getenv("TRITON_HTTP_URL", "http://localhost:8000")
|
| 19 |
+
MODEL_NAME: str = os.getenv("MODEL_NAME", "wizardlm-7b")
|
| 20 |
+
|
| 21 |
+
# API Configuration
|
| 22 |
+
API_HOST: str = os.getenv("API_HOST", "0.0.0.0")
|
| 23 |
+
API_PORT: int = int(os.getenv("API_PORT", "8080"))
|
| 24 |
+
DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
|
| 25 |
+
SECRET_KEY: str = os.getenv("SECRET_KEY", "your-secret-key-here")
|
| 26 |
+
|
| 27 |
+
# Database
|
| 28 |
+
DATABASE_URL: str = os.getenv("DATABASE_URL", "postgresql://user:pass@localhost/diamond_ai")
|
| 29 |
+
REDIS_URL: str = os.getenv("REDIS_URL", "redis://localhost:6379")
|
| 30 |
+
|
| 31 |
+
# JWT
|
| 32 |
+
JWT_SECRET: str = os.getenv("JWT_SECRET", "your-jwt-secret")
|
| 33 |
+
JWT_ALGORITHM: str = os.getenv("JWT_ALGORITHM", "HS256")
|
| 34 |
+
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30"))
|
| 35 |
+
|
| 36 |
+
# CORS
|
| 37 |
+
ALLOWED_ORIGINS: list = os.getenv("ALLOWED_ORIGINS", "http://localhost:3000,http://localhost:8080").split(",")
|
| 38 |
+
|
| 39 |
+
class Config:
|
| 40 |
+
env_file = ".env"
|
| 41 |
+
|
| 42 |
+
settings = Settings()
|