# 阿里云OSS配置示例 # 将此文件复制为 config.yaml 或 config.prod.yaml,并填入你的实际配置信息 server: port: 8080 mode: release database: driver: mysql host: 127.0.0.1 port: 3306 username: root password: "your-password" dbname: ai_dianshang charset: utf8mb4 parseTime: true loc: Local redis: host: localhost port: 6379 password: "" db: 0 jwt: secret: "your-jwt-secret-key-change-this-in-production" expire: 7200 log: level: info filename: logs/app.log maxSize: 100 maxAge: 30 maxBackups: 5 enableConsole: true enableFile: true format: json enableCaller: true enableOperation: true enablePerf: true perfThreshold: 1000 wechat: appId: "your-wechat-appid" appSecret: "your-wechat-appsecret" wechatPay: environment: "production" appId: "your-wechat-appid" mchId: "your-merchant-id" apiV3Key: "your-api-v3-key-32-characters" certPath: "certs/apiclient_cert.pem" keyPath: "certs/apiclient_key.pem" serialNo: "your-certificate-serial-number" notifyUrl: "https://yourdomain.com/api/v1/payment/notify" refundNotifyUrl: "https://yourdomain.com/api/refunds/callback" # ========== 文件上传配置 ========== upload: maxImageSize: 5242880 # 5MB maxFileSize: 10485760 # 10MB imageTypes: [".jpg", ".jpeg", ".png", ".gif", ".webp", ".svg"] # 存储类型选择: # - local: 本地存储(默认) # - oss: 阿里云OSS storageType: "oss" # 本地存储配置(storageType为local时使用) staticPath: "./static" baseUrl: "https://yourdomain.com" # 阿里云OSS配置(storageType为oss时使用) oss: # OSS访问域名(Endpoint) # 根据你的Bucket所在地域选择: # - 华东1(杭州):oss-cn-hangzhou.aliyuncs.com # - 华东2(上海):oss-cn-shanghai.aliyuncs.com # - 华北1(青岛):oss-cn-qingdao.aliyuncs.com # - 华北2(北京):oss-cn-beijing.aliyuncs.com # - 华南1(深圳):oss-cn-shenzhen.aliyuncs.com # 更多地域请参考:https://help.aliyun.com/document_detail/31837.html endpoint: "oss-cn-hangzhou.aliyuncs.com" # AccessKey ID(在阿里云控制台获取) # 建议使用RAM子账号的AccessKey,并授予最小权限 accessKeyId: "your-access-key-id" # AccessKey Secret(在阿里云控制台获取) accessKeySecret: "your-access-key-secret" # Bucket名称(需要提前在OSS控制台创建) bucketName: "your-bucket-name" # 文件存储基础路径(可选,建议设置以便文件分类管理) # 例如:dianshang/ 表示所有文件都存储在 dianshang/ 目录下 basePath: "dianshang/" # 自定义域名(可选) # 如果你配置了CDN加速域名或自定义域名,填写这里 # 例如:https://cdn.yourdomain.com # 如果不填写,将使用默认的OSS域名:https://bucket-name.endpoint/ domain: "" # ========== OSS配置说明 ========== # # 1. 创建OSS Bucket: # - 登录阿里云OSS控制台:https://oss.console.aliyun.com/ # - 创建Bucket,选择合适的地域和存储类型 # - 设置读写权限为"公共读"(如果需要直接访问)或"私有"(使用签名URL访问) # # 2. 获取AccessKey: # - 访问:https://ram.console.aliyun.com/manage/ak # - 建议创建RAM子账号,只授予OSS相关权限(AliyunOSSFullAccess) # - 获取AccessKey ID和AccessKey Secret # # 3. 配置跨域(CORS): # - 在OSS控制台的Bucket设置中配置CORS规则 # - 允许的来源:* 或你的域名 # - 允许的方法:GET, POST, PUT, DELETE, HEAD # - 允许的Headers:* # # 4. CDN加速(可选但推荐): # - 在OSS控制台绑定自定义域名 # - 开启CDN加速以提升访问速度 # - 配置HTTPS证书 # - 将domain设置为你的CDN域名 # # 5. 切换存储方式: # - 修改 storageType 为 "local" 使用本地存储 # - 修改 storageType 为 "oss" 使用阿里云OSS # - 系统支持降级:OSS上传失败时自动切换到本地存储