- 将所有文件路径转换为 URL 友好格式,统一使用正斜杠,确保跨平台兼容 - 修改默认服务器监听端口为 :8989,提升默认配置适用性 - 数据库初始化时创建数据库文件夹,避免路径不存在导致错误 - 新增 AGENTS.md 文档,详细规范项目开发流程、代码风格、架构设计和安全性能指导 - 修正头像路径显示逻辑,确保头像 URL 正确展示 - 增加应用启动和开发的标准操作指南,提升团队协作效率
54 lines
862 B
Go
54 lines
862 B
Go
package config
|
|
|
|
import "time"
|
|
|
|
type Config struct {
|
|
Server ServerConfig
|
|
Database DatabaseConfig
|
|
Session SessionConfig
|
|
App AppConfig
|
|
}
|
|
|
|
type ServerConfig struct {
|
|
Port string
|
|
ReadTimeout time.Duration
|
|
WriteTimeout time.Duration
|
|
}
|
|
|
|
type DatabaseConfig struct {
|
|
Path string
|
|
}
|
|
|
|
type SessionConfig struct {
|
|
Secret string
|
|
Name string
|
|
}
|
|
|
|
type AppConfig struct {
|
|
Name string
|
|
Version string
|
|
}
|
|
|
|
var AppConfigInstance = &Config{
|
|
Server: ServerConfig{
|
|
Port: ":8989",
|
|
ReadTimeout: 10 * time.Second,
|
|
WriteTimeout: 10 * time.Second,
|
|
},
|
|
Database: DatabaseConfig{
|
|
Path: "data/lv8girl.db",
|
|
},
|
|
Session: SessionConfig{
|
|
Secret: "lv8girl-secret-key-change-in-production",
|
|
Name: "lv8girl_session",
|
|
},
|
|
App: AppConfig{
|
|
Name: "lv8girl",
|
|
Version: "1.0.0",
|
|
},
|
|
}
|
|
|
|
func GetConfig() *Config {
|
|
return AppConfigInstance
|
|
}
|