Add claude config
This commit is contained in:
24
config.py
24
config.py
@@ -4,6 +4,12 @@ Configuration settings for the invoice extraction system.
|
||||
|
||||
import os
|
||||
import platform
|
||||
from pathlib import Path
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables from .env file
|
||||
env_path = Path(__file__).parent / '.env'
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
|
||||
|
||||
def _is_wsl() -> bool:
|
||||
@@ -21,14 +27,22 @@ def _is_wsl() -> bool:
|
||||
|
||||
|
||||
# PostgreSQL Database Configuration
|
||||
# Now loaded from environment variables for security
|
||||
DATABASE = {
|
||||
'host': '192.168.68.31',
|
||||
'port': 5432,
|
||||
'database': 'docmaster',
|
||||
'user': 'docmaster',
|
||||
'password': '0412220',
|
||||
'host': os.getenv('DB_HOST', '192.168.68.31'),
|
||||
'port': int(os.getenv('DB_PORT', '5432')),
|
||||
'database': os.getenv('DB_NAME', 'docmaster'),
|
||||
'user': os.getenv('DB_USER', 'docmaster'),
|
||||
'password': os.getenv('DB_PASSWORD'), # No default for security
|
||||
}
|
||||
|
||||
# Validate required configuration
|
||||
if not DATABASE['password']:
|
||||
raise ValueError(
|
||||
"DB_PASSWORD environment variable is not set. "
|
||||
"Please create a .env file based on .env.example and set DB_PASSWORD."
|
||||
)
|
||||
|
||||
# Connection string for psycopg2
|
||||
def get_db_connection_string():
|
||||
return f"postgresql://{DATABASE['user']}:{DATABASE['password']}@{DATABASE['host']}:{DATABASE['port']}/{DATABASE['database']}"
|
||||
|
||||
Reference in New Issue
Block a user