Skip to content

Commit c247861

Browse files
committed
update: configs
1 parent 7c7404d commit c247861

14 files changed

Lines changed: 80 additions & 19 deletions

File tree

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ bin/
1111
.qwen/skills/
1212

1313
# Local certs (generated)
14-
config/certs/*.pem
15-
config/certs/*.zip
14+
configs/certs/*.pem
15+
configs/certs/*.zip
1616

1717
# Local config (may contain secrets)
1818
# NOTE: environment configs are now tracked; only config.yaml (potential secrets) is ignored
19-
config/config.yaml
19+
configs/config.yaml
2020

2121
# Dependencies
2222
vendor/

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,21 @@ make generate && make wire && make build
9797
# 运行(默认 MySQL/Redis/Kafka/RabbitMQ 均为 enabled:false,无需依赖即可启动)
9898
./bin/server -conf=./config
9999

100+
# 指定环境配置(-e 或 --env,加载 config/{env}/config.yaml)
101+
./bin/server -e local
102+
./bin/server -e prod
103+
100104
# CLI 定时任务
101105
go build -o bin/task ./cmd/task/
102-
./bin/task savePageDataCron -conf=./config
106+
107+
# 交互命令(cobra CLI,支持 -conf/-c 指定配置目录,-e 指定环境)
108+
./bin/task help # 查看帮助
109+
./bin/task # 默认执行 savePageData
110+
./bin/task savePageData # 爬数据入库(单次)
111+
./bin/task savePageData -e local # 使用 local 环境配置
112+
./bin/task savePageDataCron # 爬数据入库(单次运行)
113+
./bin/task savePageDataCron --daemon # 按 cron 循环运行
114+
./bin/task savePageDataCron -e prod --daemon # 生产环境循环爬取
103115
```
104116

105117
默认 HTTP 端口 `8989`(与原 Gin 项目一致),Hello 接口:`GET http://127.0.0.1:8989/test`

cmd/server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333
)
3434

3535
func init() {
36-
flag.StringVar(&Flagconfig, "conf", "./config", "config directory, eg: -conf ./config")
36+
flag.StringVar(&Flagconfig, "conf", "./configs", "config directory, eg: -conf ./configs")
3737
flag.StringVar(&Flagenv, "e", "", "env shorthand: local, prod, integration → config/{env}")
3838
}
3939

cmd/task/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
func init() {
1717
// Register flags on rootCmd so cobra recognizes them
18-
rootCmd.PersistentFlags().StringVarP(&flagconf, "conf", "c", "./config", "config directory, eg: -conf ./config")
18+
rootCmd.PersistentFlags().StringVarP(&flagconf, "conf", "c", "./configs", "config directory, eg: -conf ./configs")
1919
rootCmd.PersistentFlags().StringVarP(&flagenv, "e", "e", "", "env shorthand (Gin parity): local, prod, integration → config/{env}")
2020
rootCmd.PersistentFlags().StringVar(&flagenv, "env", "", "alias for -e")
2121

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
complete the task GetAllTagsData at 2026-06-04T23:52:58+08:00

0 commit comments

Comments
 (0)