32 lines
744 B
Go
32 lines
744 B
Go
package config
|
|
|
|
import "os"
|
|
|
|
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"`
|
|
}
|
|
|
|
type Avatar struct {
|
|
Dirname string `json:"dirname" yaml:"dirname"`
|
|
}
|
|
|
|
type System struct {
|
|
Settings map[string]string `json:"settings" yaml:"settings"`
|
|
}
|
|
|
|
type Config struct {
|
|
Avatar Avatar `json:"avatar" yaml:"avatar"`
|
|
System System `json:"system" yaml:"system"`
|
|
Database Database `json:"database" yaml:"database"`
|
|
AdminUsers []string `json:"admin_users" yaml:"adminUsers"`
|
|
}
|
|
|
|
func New() *Config {
|
|
cfg := &Config{}
|
|
cfg.Avatar.Dirname = os.TempDir()
|
|
return cfg
|
|
}
|