更新环境配置,优化数据库和Redis连接设置
- 修改`.env.example`文件,更新数据库和Redis的默认主机地址为`192.168.9.127` - 在`docker-compose.yml`中移除不必要的卷挂载配置 - 在`go.mod`中添加`github.com/joho/godotenv`依赖以支持环境变量加载 - 更新`README.md`以反映新的数据库和Redis连接信息 - 在`main.go`中加载环境变量以支持动态配置 - 新增缓存存在性检查功能,避免重复预热缓存 - 优化CSV读取逻辑,支持从S3获取数据
This commit is contained in:
@@ -46,6 +46,7 @@ func (h *ModelCSVHandler) GetModelCSV(c *gin.Context) {
|
||||
key := modelCSVKey(brand, model, form)
|
||||
ctx := c.Request.Context()
|
||||
|
||||
h.log.Info("reading csv from s3", zap.String("key", key))
|
||||
data, err := h.s3.GetObject(ctx, key)
|
||||
if err != nil {
|
||||
var noSuchKey *types.NoSuchKey
|
||||
@@ -86,6 +87,11 @@ func (h *ModelCSVHandler) GetModelCSV(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
func targetCSVKey(file string) string {
|
||||
file = strings.TrimPrefix(strings.TrimSpace(file), "/")
|
||||
return "autoeq/targets/" + file
|
||||
}
|
||||
|
||||
func modelCSVKey(brand, model, form string) string {
|
||||
filename := brand + " " + model + ".csv"
|
||||
return fmt.Sprintf("autoeq/measurements/Eafonyoung/data/%s/%s/%s",
|
||||
|
||||
Reference in New Issue
Block a user