2024-10-21 22:27:42 +08:00
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
import (
|
2025-06-27 12:17:45 +08:00
|
|
|
"cmp"
|
2024-10-21 22:27:42 +08:00
|
|
|
sysapp "mayfly-go/internal/sys/application"
|
|
|
|
|
|
2025-06-27 12:17:45 +08:00
|
|
|
"github.com/spf13/cast"
|
2024-10-21 22:27:42 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
ConfigKeyFile string = "FileConfig" // 文件配置key
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type FileConfig struct {
|
|
|
|
|
BasePath string // 文件基础路径
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func GetFileConfig() *FileConfig {
|
|
|
|
|
c := sysapp.GetConfigApp().GetConfig(ConfigKeyFile)
|
|
|
|
|
jm := c.GetJsonMap()
|
|
|
|
|
|
|
|
|
|
fc := new(FileConfig)
|
2025-06-27 12:17:45 +08:00
|
|
|
fc.BasePath = cmp.Or(cast.ToString(jm["basePath"]), "./file")
|
2024-10-21 22:27:42 +08:00
|
|
|
return fc
|
|
|
|
|
}
|