37 lines
1.5 KiB
Python
37 lines
1.5 KiB
Python
"""Deployment settings; credentials are read separately and never fingerprinted."""
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
|
|
|
|
def path_setting(name, default):
|
|
return Path(os.environ.get(name) or default).expanduser().resolve()
|
|
|
|
|
|
def executable(name, default):
|
|
value = os.environ.get(name) or default
|
|
return shutil.which(os.path.expanduser(value)) or os.path.expanduser(value)
|
|
|
|
|
|
ROOT = path_setting('PCB_SESSION_ROOT', Path.home() / '.local/share/vibemake-pcb')
|
|
MODEL = os.environ.get('PCB_MODEL') or 'gpt-6.1-sol'
|
|
EFFORT = os.environ.get('PCB_REASONING_EFFORT') or 'high'
|
|
# Preserve existing installations unless API authentication is explicitly selected.
|
|
AUTH_MODE = os.environ.get('PCB_CODEX_AUTH') or 'chatgpt'
|
|
PROVIDER = 'vibemake_openai' if AUTH_MODE == 'apikey' else 'openai'
|
|
CODEX_HOME = path_setting('PCB_CODEX_HOME', ROOT / 'codex-home')
|
|
CODEX_BIN = executable('PCB_CODEX_BIN', 'codex')
|
|
EDA_BIN = executable('PCB_EDA_BIN', 'lceda-pro')
|
|
BLENDER_BIN = executable('PCB_BLENDER_BIN', 'blender')
|
|
FREEROUTING_JAR = path_setting('PCB_FREEROUTING_JAR', ROOT / 'resources/freerouting.jar')
|
|
|
|
|
|
def frozen_settings():
|
|
# Key rotation is allowed; changing the runtime of an approved design is not.
|
|
return {name: str(value) for name, value in {
|
|
'root': ROOT, 'model': MODEL, 'effort': EFFORT, 'auth_mode': AUTH_MODE,
|
|
'provider': PROVIDER, 'codex_home': CODEX_HOME, 'codex_bin': CODEX_BIN,
|
|
'eda_bin': EDA_BIN, 'blender_bin': BLENDER_BIN,
|
|
'freerouting_jar': FREEROUTING_JAR,
|
|
}.items()}
|