Files
pulp-console/app/config.py
Hyemin Lee 7ad6d65a11 feat: gated deploy with preview, audit log, rollback trail (stage 4)
- pulp_client: create_publication / update_distribution / wait_for_task
- GET /repos/{uuid}/deploy/confirm: 미리보기(현재→대상, 순 변화) + type-to-confirm 모달
- POST /repos/{uuid}/deploy: 검증 게이트(서버측 재확인) → publication 생성 →
  distribution 교체 → 감사 로그. 2단계 실패 시 '운영망 변경 여부' 명확화
- audit.record_deploy: 누가/언제/repo/이전버전→대상버전 JSONL (롤백 추적)
- 배포 버튼은 검증 통과 + 미배포 버전만 활성, 성공 시 버전목록 OOB 갱신
- 인증은 TODO (operator placeholder, 배포 비밀번호 재확인 예정)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 13:31:15 +09:00

40 lines
1.2 KiB
Python

"""환경변수 기반 설정 (스펙 §8).
사내망 TLS(self-signed CA) 대응을 처음부터 넣어둔다 — httpx 의 verify 인자에
CA 파일 경로 또는 bool 을 그대로 넘길 수 있게 ``tls_verify`` 로 변환한다.
"""
from __future__ import annotations
from functools import lru_cache
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env", env_file_encoding="utf-8", extra="ignore"
)
pulp_base_url: str = "http://localhost:8080"
pulp_username: str = "admin"
pulp_password: str = ""
pulp_verify_tls: bool = True
pulp_ca_file: str | None = None
# 임시: 실제 Pulp 없이 가짜 데이터로 화면 확인 (단계5 전 제거 가능)
pulp_demo: bool = False
# 배포 감사 로그 (append-only JSONL)
audit_log_path: str = "audit-log.jsonl"
@lru_cache
def get_settings() -> Settings:
return Settings()
def tls_verify(settings: Settings) -> str | bool:
"""httpx ``verify=`` 에 넘길 값. CA 파일 경로가 있으면 우선, 없으면 bool."""
if settings.pulp_ca_file:
return settings.pulp_ca_file
return settings.pulp_verify_tls