mirror of
https://github.com/likeshop-github/likeadmin_go.git
synced 2025-12-24 13:07:57 +08:00
feat: 增加默认静态资源,及增加静态资源路由配置
This commit is contained in:
@@ -26,6 +26,8 @@ type envConfig struct {
|
||||
DbConnMaxLifetimeHours int16 // 连接可复用的最大时间(小时)
|
||||
Version string // 版本
|
||||
Secret string // 系统加密字符
|
||||
StaticPath string // 静态资源URL路径
|
||||
StaticDirectory string // 静态资源本地路径
|
||||
RedisPrefix string // Redis键前缀
|
||||
UploadImageSize int64 // 上传图片限制
|
||||
UploadVideoSize int64 // 上传视频限制
|
||||
@@ -68,6 +70,10 @@ func loadConfig(path string) envConfig {
|
||||
Version: "v1.0.0",
|
||||
// 系统加密字符
|
||||
Secret: "UVTIyzCy",
|
||||
// 静态资源URL路径
|
||||
StaticPath: "/api/static",
|
||||
// 静态资源本地路径
|
||||
StaticDirectory: "static",
|
||||
// Redis键前缀
|
||||
RedisPrefix: "Like:",
|
||||
// 上传图片限制
|
||||
|
||||
@@ -19,6 +19,7 @@ func initRouter() *gin.Engine {
|
||||
router := gin.New()
|
||||
// 设置静态路径
|
||||
router.Static(config.Config.PublicPrefix, config.Config.UploadDirectory)
|
||||
router.Static(config.Config.StaticPath, config.Config.StaticDirectory)
|
||||
// 设置中间件
|
||||
router.Use(gin.Logger(), middleware.Cors(), middleware.ErrorRecover())
|
||||
// 特殊异常处理
|
||||
|
||||
BIN
server/static/backend_avatar.png
Normal file
BIN
server/static/backend_avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
BIN
server/static/backend_backdrop.png
Normal file
BIN
server/static/backend_backdrop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
BIN
server/static/backend_favicon.ico
Normal file
BIN
server/static/backend_favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
BIN
server/static/backend_logo.png
Normal file
BIN
server/static/backend_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Reference in New Issue
Block a user