paijo77 commited on
Commit
8e2aea8
·
verified ·
1 Parent(s): 520f36d

update app/config/__init__.py

Browse files
Files changed (1) hide show
  1. app/config/__init__.py +48 -0
app/config/__init__.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import secrets
3
+ from pydantic_settings import BaseSettings, SettingsConfigDict
4
+ from pathlib import Path
5
+
6
+ # Get project root
7
+ BASE_DIR = Path(__file__).parent.parent.parent
8
+
9
+
10
+ class Settings(BaseSettings):
11
+ # App Settings
12
+ PROJECT_NAME: str = "1proxy"
13
+ API_V1_STR: str = "/api/v1"
14
+
15
+ # SECRET_KEY: Auto-generate secure default for HuggingFace/development
16
+ # IMPORTANT: Set this in production via environment variable!
17
+ SECRET_KEY: str = os.getenv("SECRET_KEY", secrets.token_urlsafe(32))
18
+
19
+ ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7 # 7 days
20
+
21
+ # URLs - Auto-detect HuggingFace Space environment
22
+ API_URL: str = (
23
+ os.getenv("SPACE_HOST", "").replace("https://", "https://")
24
+ if os.getenv("SPACE_HOST")
25
+ else "http://localhost:8000"
26
+ )
27
+ FRONTEND_URL: str = os.getenv("SPACE_HOST", "http://localhost:3000")
28
+
29
+ # OAuth
30
+ GITHUB_CLIENT_ID: str = ""
31
+ GITHUB_CLIENT_SECRET: str = ""
32
+ GOOGLE_CLIENT_ID: str = ""
33
+ GOOGLE_CLIENT_SECRET: str = ""
34
+
35
+ # Admin Access - GitHub Repository Collaboration
36
+ # Users with admin/owner/collaborator access to this repo get admin role
37
+ GITHUB_REPO_OWNER: str = ""
38
+ GITHUB_REPO_NAME: str = ""
39
+
40
+ # Database
41
+ DATABASE_URL: str = "sqlite+aiosqlite:///./data/1proxy.db"
42
+
43
+ model_config = SettingsConfigDict(
44
+ env_file=str(BASE_DIR / ".env"), env_file_encoding="utf-8", extra="ignore"
45
+ )
46
+
47
+
48
+ settings = Settings()