2024-04-03 09:05:12 +00:00
|
|
|
package models
|
|
|
|
|
2024-04-11 02:51:50 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
2024-04-03 09:05:12 +00:00
|
|
|
|
|
|
|
const (
|
|
|
|
SettingsKeyAdminUsername = "admin.username"
|
|
|
|
SettingsKeyAdminPassword = "admin.password"
|
|
|
|
SettingsKeyDNSServer = "dns.servers"
|
|
|
|
)
|
|
|
|
|
2024-04-19 04:47:00 +00:00
|
|
|
// Settings settings for this app
|
2024-04-03 09:05:12 +00:00
|
|
|
type Settings struct {
|
2024-04-19 01:44:37 +00:00
|
|
|
ID uint `gorm:"primaryKey"`
|
2024-04-11 02:51:50 +00:00
|
|
|
Key string `gorm:"unique;not null;size:255"`
|
|
|
|
Value string `gorm:"not null;size:255"`
|
|
|
|
}
|
|
|
|
|
2024-04-11 03:41:33 +00:00
|
|
|
func (s *Settings) String() string {
|
2024-04-11 02:51:50 +00:00
|
|
|
return fmt.Sprintf("%s: %s", s.Key, s.Value)
|
|
|
|
}
|
|
|
|
|
2024-04-19 01:44:37 +00:00
|
|
|
func (s *Settings) GetValue() Settings {
|
|
|
|
return *s
|
|
|
|
}
|
|
|
|
|
2024-04-11 02:51:50 +00:00
|
|
|
type ISettings interface {
|
|
|
|
String() string
|
2024-04-19 01:44:37 +00:00
|
|
|
GetValue() Settings
|
2024-04-03 09:05:12 +00:00
|
|
|
}
|