From a91948a18ceb19334ce368fa809668000267a7b5 Mon Sep 17 00:00:00 2001 From: Milky0217 Date: Sun, 19 Apr 2026 20:35:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor(config):=20=E7=BB=9F=E4=B8=80=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=AE=A1=E7=90=86=EF=BC=8C=E7=A7=BB=E9=99=A4=E5=86=97?= =?UTF-8?q?=E4=BD=99=E7=9A=84=20app=5Fversion=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 config/*.toml 中的 app_version 字段(代码中未使用) - 版本号统一由 Cargo.toml 管理 - Cargo.lock 自动同步更新 - 更新 AGENTS.md 添加版本管理说明 --- AGENTS.md | 13 +++++++++++++ Cargo.lock | 2 +- config/default.toml | 11 +++++++++++ config/development.toml | 11 +++++++++++ config/production.toml | 11 +++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 config/default.toml create mode 100644 config/development.toml create mode 100644 config/production.toml diff --git a/AGENTS.md b/AGENTS.md index 7262c62..e4e1192 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -118,6 +118,19 @@ APP_WECHAT_APPID=wx... `环境变量 > production.toml > development.toml > default.toml` +### 版本管理 + +**版本号统一在 `Cargo.toml` 中管理**: + +```toml +[package] +name = "rust-backend" +version = "0.3.0" # 唯一版本定义 +edition = "2024" +``` + +**不再使用 `app_version` 字段**(已移除)。 + --- ## 数据库 diff --git a/Cargo.lock b/Cargo.lock index 49534c0..b452df1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1960,7 +1960,7 @@ dependencies = [ [[package]] name = "rust-backend" -version = "0.1.0" +version = "0.3.0" dependencies = [ "actix-files", "actix-web", diff --git a/config/default.toml b/config/default.toml new file mode 100644 index 0000000..6c60aea --- /dev/null +++ b/config/default.toml @@ -0,0 +1,11 @@ +database_url = "postgres://milkydata:password@localhost:5432/milkydata_dev" +wechat_appid = "wx_test_appid" +wechat_secret = "test_secret" +jwt_secret = "dev-only-secret-change-in-production" +ssl_key_path = "" +ssl_cert_path = "" +rust_log = "debug" +environment = "development" +free_user_data_limit = 100 +server_host = "0.0.0.0" +server_ports = [8080, 3000, 8000, 8888] \ No newline at end of file diff --git a/config/development.toml b/config/development.toml new file mode 100644 index 0000000..6419f75 --- /dev/null +++ b/config/development.toml @@ -0,0 +1,11 @@ +database_url = "postgres://milkydata:44n6FdB8CdDAk5rk@127.0.0.1:5432/milkydata_dev" +wechat_appid = "wx5b00eb90621802f7" +wechat_secret = "494efc513faa310bfba588bda2849bfd" +jwt_secret = "dev-only-secret-change-in-production" +ssl_key_path = "" +ssl_cert_path = "" +rust_log = "debug" +environment = "development" +free_user_data_limit = 100 +server_host = "0.0.0.0" +server_ports = [8080, 3000, 8000, 8888] \ No newline at end of file diff --git a/config/production.toml b/config/production.toml new file mode 100644 index 0000000..022882c --- /dev/null +++ b/config/production.toml @@ -0,0 +1,11 @@ +database_url = "postgres://milkydata:44n6FdB8CdDAk5rk@154.37.213.24:5432/milkydata" +wechat_appid = "wx5b00eb90621802f7" +wechat_secret = "494efc513faa310bfba588bda2849bfd" +jwt_secret = "your_super_secret_key" +ssl_key_path = "/etc/ssl/private/private.key" +ssl_cert_path = "/etc/ssl/certs/full_chain.pem" +rust_log = "info" +environment = "production" +free_user_data_limit = 20 +server_host = "0.0.0.0" +server_ports = [4433, 8443, 8080, 3000, 8000, 8888] \ No newline at end of file