23 lines
		
	
	
		
			647 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			647 B
		
	
	
	
		
			Go
		
	
	
	
	
	
|  | package config | ||
|  | 
 | ||
|  | import ( | ||
|  | 	"github.com/zeromicro/go-zero/core/stores/cache" | ||
|  | 	"github.com/zeromicro/go-zero/rest" | ||
|  | 	"github.com/zeromicro/go-zero/zrpc" | ||
|  | ) | ||
|  | 
 | ||
|  | type Config struct { | ||
|  | 	rest.RestConf | ||
|  | 	DataSource  string          // 数据库连接的 DSN 字符串 | ||
|  | 	AuthJWT     AuthConfig      // JWT 鉴权相关配置 | ||
|  | 	CacheRedis  cache.CacheConf // 缓存配置,使用 go-zero 自带的缓存配置结构体 | ||
|  | 	UserRpc     zrpc.RpcClientConf | ||
|  | 	SentinelRpc zrpc.RpcClientConf | ||
|  | } | ||
|  | 
 | ||
|  | // AuthConfig 用于 JWT 鉴权配置 | ||
|  | type AuthConfig struct { | ||
|  | 	AccessSecret string // JWT 密钥,用于签发 Token | ||
|  | 	AccessExpire int64  // Token 过期时间,单位为秒 | ||
|  | } |