wails-app-dock/pkg/config/config.go
2024-02-17 21:45:43 +08:00

29 lines
616 B
Go

package config
type Config struct {
Server *ServerConfig `toml:"server" json:"server" comment:"服务配置"`
Debug *DebuggerConfig `toml:"debug" json:"debug" comment:"调试模式"`
}
type ServerConfig struct {
Host string `toml:"host" json:"host" comment:"监听ip"`
Port int `toml:"port" json:"port" comment:"监听端口"`
}
type DebuggerConfig struct {
Enable bool `toml:"enable" json:"enable" comment:"启用"`
}
func (c *Config) HasDebug() bool {
return c.Debug != nil
}
func DefaultConfig() *Config {
return &Config{
Server: &ServerConfig{
Host: "localhost",
Port: 12121,
},
}
}