2024-12-12 11:45:03 +08:00
|
|
|
package config
|
|
|
|
|
2024-12-13 10:37:09 +08:00
|
|
|
import "os"
|
|
|
|
|
2024-12-12 11:45:03 +08:00
|
|
|
type Database struct {
|
|
|
|
Address string `json:"address" yaml:"address"`
|
|
|
|
Username string `json:"username" yaml:"username"`
|
|
|
|
Password string `json:"password" yaml:"password"`
|
|
|
|
Database string `json:"database" yaml:"database"`
|
|
|
|
}
|
|
|
|
|
2024-12-13 10:37:09 +08:00
|
|
|
type Avatar struct {
|
|
|
|
Dirname string `json:"dirname" yaml:"dirname"`
|
|
|
|
}
|
|
|
|
|
2024-12-12 11:45:03 +08:00
|
|
|
type Config struct {
|
2024-12-13 10:37:09 +08:00
|
|
|
Database Database `json:"database" yaml:"database"`
|
|
|
|
Avatar Avatar `json:"avatar" yaml:"avatar"`
|
|
|
|
AdminUsers []string `json:"admin_users" yaml:"adminUsers"`
|
2024-12-12 11:45:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func New() *Config {
|
|
|
|
cfg := &Config{}
|
2024-12-13 10:37:09 +08:00
|
|
|
cfg.Avatar.Dirname = os.TempDir()
|
2024-12-12 11:45:03 +08:00
|
|
|
return cfg
|
|
|
|
}
|