- 修复YAML配置文件字段格式错误(大写->小写) - 修复JWT密钥未正确识别的问题 - 修复容器内配置文件路径问题,使用绝对路径/etc/photography-api.yaml - 修复迁移工具配置文件路径 - 修复Dockerfile工作目录设置 解决了'field auth.access_secret is not set'的配置错误
This commit is contained in:
@ -58,6 +58,9 @@ COPY --from=builder /app/etc /etc
|
||||
# 设置时区
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
# 创建工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 创建非root用户 (在scratch镜像中需要手动创建)
|
||||
USER 65534:65534
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import (
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/photography-api.yaml", "the config file")
|
||||
var configFile = flag.String("f", "/etc/photography-api.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
@ -16,7 +16,7 @@ import (
|
||||
func main() {
|
||||
// 命令行参数
|
||||
var (
|
||||
configFile = flag.String("f", "etc/photographyapi-api.yaml", "配置文件路径")
|
||||
configFile = flag.String("f", "/etc/photography-api.yaml", "配置文件路径")
|
||||
command = flag.String("c", "status", "迁移命令: up, down, status, reset, migrate")
|
||||
steps = flag.Int("s", 0, "步数(用于 down 和 migrate 命令)")
|
||||
version = flag.String("v", "", "迁移版本(用于特定版本操作)")
|
||||
@ -142,7 +142,7 @@ func showHelp() {
|
||||
fmt.Println(" go run cmd/migrate/main.go [选项] [参数]")
|
||||
fmt.Println()
|
||||
fmt.Println("选项:")
|
||||
fmt.Println(" -f string 配置文件路径 (默认: etc/photographyapi-api.yaml)")
|
||||
fmt.Println(" -f string 配置文件路径 (默认: /etc/photography-api.yaml)")
|
||||
fmt.Println(" -c string 迁移命令 (默认: status)")
|
||||
fmt.Println(" -s int 步数,用于 down 和 migrate 命令")
|
||||
fmt.Println(" -v string 迁移版本,用于特定版本操作")
|
||||
|
||||
@ -3,41 +3,41 @@ Host: 0.0.0.0
|
||||
Port: 8080
|
||||
|
||||
# 数据库配置
|
||||
Database:
|
||||
Driver: sqlite
|
||||
FilePath: data/photography.db
|
||||
Host: localhost
|
||||
Port: 5432
|
||||
Database: photography
|
||||
Username: postgres
|
||||
Password: ""
|
||||
Charset: utf8mb4
|
||||
SSLMode: disable
|
||||
MaxOpenConns: 100
|
||||
MaxIdleConns: 10
|
||||
database:
|
||||
driver: sqlite
|
||||
file_path: data/photography.db
|
||||
host: localhost
|
||||
port: 5432
|
||||
database: photography
|
||||
username: postgres
|
||||
password: ""
|
||||
charset: utf8mb4
|
||||
ssl_mode: disable
|
||||
max_open_conns: 100
|
||||
max_idle_conns: 10
|
||||
|
||||
# 认证配置
|
||||
Auth:
|
||||
AccessSecret: photography-secret-key-2024
|
||||
AccessExpire: 86400
|
||||
auth:
|
||||
access_secret: photography-secret-key-2024
|
||||
access_expire: 86400
|
||||
|
||||
# 文件上传配置
|
||||
FileUpload:
|
||||
MaxSize: 10485760 # 10MB
|
||||
UploadDir: uploads
|
||||
AllowedTypes:
|
||||
file_upload:
|
||||
max_size: 10485760 # 10MB
|
||||
upload_dir: uploads
|
||||
allowed_types:
|
||||
- image/jpeg
|
||||
- image/png
|
||||
- image/gif
|
||||
- image/webp
|
||||
|
||||
# 中间件配置
|
||||
Middleware:
|
||||
EnableCORS: true
|
||||
EnableLogger: true
|
||||
EnableErrorHandle: true
|
||||
CORSOrigins:
|
||||
middleware:
|
||||
enable_cors: true
|
||||
enable_logger: true
|
||||
enable_error_handle: true
|
||||
cors_origins:
|
||||
- http://localhost:3000
|
||||
- http://localhost:3001
|
||||
- http://localhost:5173
|
||||
LogLevel: info
|
||||
log_level: info
|
||||
|
||||
Reference in New Issue
Block a user