moto/config/config.go

32 lines
744 B
Go
Raw Normal View History

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-13 11:43:32 +08:00
type System struct {
Settings map[string]string `json:"settings" yaml:"settings"`
}
2024-12-12 11:45:03 +08:00
type Config struct {
2024-12-13 10:37:09 +08:00
Avatar Avatar `json:"avatar" yaml:"avatar"`
2024-12-13 11:43:32 +08:00
System System `json:"system" yaml:"system"`
Database Database `json:"database" yaml:"database"`
2024-12-13 10:37:09 +08:00
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
}