Bỏ qua để đến nội dung

Cấu hình

config.yaml là tùy chọn. Nếu không có, proxy khởi động với các giá trị mặc định dưới đây.

OSĐường dẫn
macOS~/Library/Application Support/sotatek-proxy/config.yaml
Linux~/.config/sotatek-proxy/config.yaml (tuân theo $XDG_CONFIG_HOME)
Windows%ProgramData%\SotatekProxy\config.yaml
# Local listener port. Loopback bind is hardcoded — `host` is not configurable.
port: 3817
# Upstream Bifrost gateway. Path is forwarded 1:1 (no strip).
upstream_url: 'https://bifrost.sotatek.works'
# TTL (seconds) for the {pid → git-remote} cache. 0 disables.
cache_ttl_seconds: 60
# Logging — rotation via lumberjack, tee'd to stdout.
log:
# file: <per-OS default — leave empty>
max_size_mb: 50 # rotate when current file exceeds this size
max_backups: 5 # keep N rotated (.gz) files
max_age_days: 30 # delete rotated files older than this
json: false # set true to emit JSON logs (Loki/ELK ingest)
# Optional profiling endpoint. Disabled by default. Loopback-only enforced at startup.
pprof:
enable: false
addr: '127.0.0.1:8316'
# Verbose logging (gin debug mode + logrus debug level).
debug: false
TrườngKiểuMặc địnhGhi chú
portint38171–65535. Loopback bind cố định.
upstream_urlstringhttps://bifrost.sotatek.worksPhải bắt đầu bằng http:// hoặc https://. http:// kích hoạt cảnh báo khởi động (API key sẽ truyền qua mạng dưới dạng plaintext).
cache_ttl_secondsint600 vô hiệu hóa cache.
log.filestringMặc định theo OSChuỗi rỗng giữ nguyên mặc định.
log.max_size_mbint50Ngưỡng kích thước để xoay vòng.
log.max_backupsint5Số file .gz đã xoay vòng cần giữ.
log.max_age_daysint30Xóa các file đã xoay vòng cũ hơn số ngày này.
log.jsonboolfalseĐịnh dạng JSON line để nạp log.
pprof.enableboolfalseBật /debug/pprof/*.
pprof.addrstring127.0.0.1:8316Phải trỏ về loopback (được kiểm tra khi khởi động).
debugboolfalseLog chi tiết + Gin debug mode.

Đặt biến, sau đó khởi động daemon. Giá trị env ghi đè YAML.

BiếnTrườngVí dụ
SOTATEK_PROXY_PORTport3818
SOTATEK_PROXY_UPSTREAMupstream_urlhttps://bifrost-staging.sotatek.works
SOTATEK_PROXY_DEBUGdebugtrue
SOTATEK_PROXY_LOG_JSONlog.jsontrue

Chỉnh sửa config.yaml và lưu — thay đổi được áp dụng trong khoảng ~500ms (fsnotify debounced). Không cần khởi động lại cho:

  • debug
  • cache_ttl_seconds
  • log.max_size_mb, log.max_backups, log.max_age_days
  • log.json

Body của inbound request bị giới hạn ở 100 MiB để phòng chống các client cục bộ không kiểm soát được. SSE / streaming response không bị ảnh hưởng. Giới hạn hiện tại là hằng số compile-time.