Files
odoo-expertos.com/directory/config.py
T
2026-08-28 10:11:11 -03:00

162 lines
4.3 KiB
Python

"""
Configuration management for Odoo Directory CLI.
Loads environment variables and provides typed configuration.
"""
import os
from pathlib import Path
from typing import Optional
from pydantic_settings import BaseSettings
from pydantic import Field
from dotenv import load_dotenv
# Load .env file from project root
PROJECT_ROOT = Path(__file__).parent.parent
load_dotenv(PROJECT_ROOT / ".env")
class Settings(BaseSettings):
"""Application settings loaded from environment variables."""
# Supabase
supabase_url: str = Field(..., alias="SUPABASE_URL")
supabase_key: str = Field(..., alias="SUPABASE_KEY")
# Apify
apify_token: str = Field(..., alias="APIFY_TOKEN")
# Firecrawl
firecrawl_api_key: str = Field(..., alias="FIRECRAWL_API_KEY")
# Anthropic
anthropic_api_key: str = Field(..., alias="ANTHROPIC_API_KEY")
# Application settings
log_level: str = Field(default="INFO", alias="LOG_LEVEL")
batch_size: int = Field(default=10, alias="BATCH_SIZE")
max_retries: int = Field(default=3, alias="MAX_RETRIES")
# Paths
export_dir: Path = Field(default=PROJECT_ROOT / "export")
images_dir: Path = Field(default=PROJECT_ROOT / "static" / "images" / "companies")
templates_dir: Path = Field(default=Path(__file__).parent / "templates")
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
extra = "ignore"
def get_settings() -> Settings:
"""Get application settings singleton."""
return Settings()
# Apify actor IDs
APIFY_GOOGLE_MAPS_ACTOR = "nwua9Gu5YrADL7ZDj" # Google Maps Scraper
# Search query templates for different languages
SEARCH_QUERIES = {
"de": [
"Odoo Partner {city}",
"Odoo Implementierung {city}",
"Odoo Beratung {city}",
"Odoo ERP {city}",
"Odoo Entwicklung {city}",
],
"en": [
"Odoo Partner {city}",
"Odoo Implementation {city}",
"Odoo Consulting {city}",
"Odoo ERP {city}",
"Odoo Development {city}",
],
"es": [
"Odoo Partner {city}",
"Odoo Implementación {city}",
"Odoo Consultoría {city}",
"Odoo ERP {city}",
"Odoo Desarrollo {city}",
],
"fr": [
"Odoo Partenaire {city}",
"Odoo Implémentation {city}",
"Odoo Conseil {city}",
"Odoo ERP {city}",
"Odoo Développement {city}",
],
"pt": [
"Odoo Parceiro {city}",
"Odoo Implementação {city}",
"Odoo Consultoria {city}",
"Odoo ERP {city}",
"Odoo Desenvolvimento {city}",
],
"ar": [
"Odoo Partner {city}",
"Odoo شريك {city}",
"Odoo ERP {city}",
],
}
# Default tags for seeding
DEFAULT_TAGS = {
"services": [
"Implementation",
"Customization",
"Training",
"Support",
"Migration",
"Integration",
"Consulting",
"Hosting",
"Development",
],
"industries": [
"Manufacturing",
"Retail",
"E-commerce",
"Healthcare",
"Education",
"Finance",
"Logistics",
"Construction",
"Food & Beverage",
"Professional Services",
],
"modules": [
"Sales",
"CRM",
"Inventory",
"Accounting",
"Manufacturing",
"Website",
"E-commerce",
"HR",
"Project",
"Purchase",
"Point of Sale",
],
"partner_levels": [
"Ready Partner",
"Silver Partner",
"Gold Partner",
"Platinum Partner",
],
}
# Germany cities for initial rollout
GERMANY_CITIES = [
{"name": "Berlin", "slug": "berlin", "state": "Berlin"},
{"name": "München", "slug": "muenchen", "state": "Bayern"},
{"name": "Hamburg", "slug": "hamburg", "state": "Hamburg"},
{"name": "Köln", "slug": "koeln", "state": "Nordrhein-Westfalen"},
{"name": "Frankfurt am Main", "slug": "frankfurt", "state": "Hessen"},
{"name": "Stuttgart", "slug": "stuttgart", "state": "Baden-Württemberg"},
{"name": "Düsseldorf", "slug": "duesseldorf", "state": "Nordrhein-Westfalen"},
{"name": "Leipzig", "slug": "leipzig", "state": "Sachsen"},
{"name": "Dortmund", "slug": "dortmund", "state": "Nordrhein-Westfalen"},
{"name": "Essen", "slug": "essen", "state": "Nordrhein-Westfalen"},
]