Files
goauto/config.example.yaml
T
QiuSWandClaude Opus 5 c86e98d0cb feat(#48): make one config work for both development and deployment
The repo already layered file defaults under environment overrides, on
both the backend (settings.yml < GOAUTO_*) and the frontend
(.env.production < process.env). What was missing was a translator for
production: config.yaml only ever existed for the PowerShell launchers,
so a packaged binary read none of it and had no database credentials
either — SYB was inheriting an existing gap, not creating one.

The server now reads config.yaml itself, between settings.yml and the
environment. Lookup is GOAUTO_CONFIG, then ./config.yaml, then beside the
executable, so a packaged binary works wherever it is started. An absent
file is not an error: containers supply everything through the
environment. Scalars are read by YAML type and coerced, so an unquoted
all-digit password cannot take startup down over a quoting detail.

This removed the need for a Read-SybConfig in PowerShell: the launcher
just hands over the path it already knows, rather than reimplementing a
YAML parser.

The server also serves the built frontend when dist is present, which is
what .env.production's empty VUE_APP_BASE_API already assumes. The
history fallback is restricted to non-API GETs, and is not installed at
all without dist, so development 404s stay 404s.

Precedence is mutation-tested: applying the local file after the
environment instead of before makes the layering test fail.

Not verified: the PowerShell change and any Windows deployment — both
need a run on the Windows side.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 09:28:45 +08:00

24 lines
739 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
database:
host: 127.0.0.1
port: 3307
user: root
password: ""
name: goauto
ports:
server: 8000
web: 9527
# 顺云宝(SYB)ERP 凭据,见 docs/12-syb-erp-interface.md。
#
# `[必须]` 只放凭据。base_url、page_size、max_matches、ocr_url 等非机密项在
# server/config/settings.yml 的 extend.syb 下,不要在这里重复定义。
#
# `[必须]` 密码要加引号。本项目容忍不加引号的纯数字密码,但 YAML 会把它读成
# 整数,前导零会丢——加引号是唯一安全的写法。
#
# 不配置 syb 段时服务端照常启动,只是 SYB 商品页的「从 SYB 导入」会提示未配置。
syb:
username: 你的顺云宝账号
password: "你的密码"