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: ":8080",
|
|
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
|
|
}
|