2024-06-02 11:57:14 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
// Configuration
|
|
|
|
type Config struct {
|
2024-06-02 13:07:09 +00:00
|
|
|
Server *Server
|
2024-06-02 11:57:14 +00:00
|
|
|
Database *Database
|
2024-06-06 18:15:27 +00:00
|
|
|
Auth *Auth
|
2024-06-02 11:57:14 +00:00
|
|
|
Log *Log
|
|
|
|
}
|
|
|
|
|
2024-06-02 13:07:09 +00:00
|
|
|
// Server configuration
|
|
|
|
type Server struct {
|
2024-06-06 18:15:27 +00:00
|
|
|
Host string `toml:"host"`
|
|
|
|
Port int `toml:"port"`
|
2024-06-02 13:07:09 +00:00
|
|
|
ReadTimeout int `toml:"read_timeout"`
|
|
|
|
WriteTimeout int `toml:"write_timeout"`
|
|
|
|
}
|
|
|
|
|
2024-06-02 11:57:14 +00:00
|
|
|
// Database configuration
|
|
|
|
type Database struct {
|
2024-06-02 11:58:48 +00:00
|
|
|
Driver string `toml:"driver"`
|
|
|
|
URL string `toml:"url"`
|
|
|
|
Max int `toml:"max"`
|
|
|
|
Idle int `toml:"idle"`
|
2024-06-02 11:57:14 +00:00
|
|
|
}
|
|
|
|
|
2024-06-06 18:15:27 +00:00
|
|
|
// Auth configuration
|
|
|
|
type Auth struct {
|
|
|
|
Secret string `toml:"secret"`
|
|
|
|
Register bool `toml:"register"`
|
|
|
|
Cost int `toml:"cost"`
|
|
|
|
}
|
|
|
|
|
2024-06-02 11:57:14 +00:00
|
|
|
// Log configuration
|
|
|
|
type Log struct {
|
|
|
|
Level string `toml:"level"`
|
|
|
|
}
|