37 lines
708 B
Go
37 lines
708 B
Go
package config
|
|
|
|
type Config struct {
|
|
Service Service `json:"service" yaml:"service"`
|
|
Database Database `json:"database" yaml:"database"`
|
|
Storage Storage `json:"storage" yaml:"storage"`
|
|
}
|
|
|
|
type Service struct {
|
|
Address string `json:"address" yaml:"address"`
|
|
Port int64 `json:"port" yaml:"port"`
|
|
}
|
|
|
|
type Database struct {
|
|
Basepath string `json:"basepath" yaml:"basepath"`
|
|
}
|
|
|
|
type Storage struct {
|
|
Basepath string `json:"basepath" yaml:"basepath"`
|
|
}
|
|
|
|
func NewConfig() (*Config, error) {
|
|
var err error
|
|
return &Config{
|
|
Service: Service{
|
|
Address: "0.0.0.0",
|
|
Port: 1025,
|
|
},
|
|
Database: Database{
|
|
Basepath: datadir,
|
|
},
|
|
Storage: Storage{
|
|
Basepath: datadir,
|
|
},
|
|
}, err
|
|
}
|