lv8girl!
This commit is contained in:
53
internal/config/config.go
Normal file
53
internal/config/config.go
Normal file
@@ -0,0 +1,53 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user