2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 05:31:44 +08:00
Files
panel/internal/biz/setting.go

44 lines
1.5 KiB
Go

package biz
import (
"time"
"github.com/tnb-labs/panel/internal/http/request"
)
type SettingKey string
const (
SettingKeyName SettingKey = "name"
SettingKeyVersion SettingKey = "version"
SettingKeyChannel SettingKey = "channel"
SettingKeyMonitor SettingKey = "monitor"
SettingKeyMonitorDays SettingKey = "monitor_days"
SettingKeyBackupPath SettingKey = "backup_path"
SettingKeyWebsitePath SettingKey = "website_path"
SettingKeyMySQLRootPassword SettingKey = "mysql_root_password"
SettingKeyOfflineMode SettingKey = "offline_mode"
SettingKeyAutoUpdate SettingKey = "auto_update"
)
type Setting struct {
ID uint `gorm:"primaryKey" json:"id"`
Key SettingKey `gorm:"not null;default:'';unique" json:"key"`
Value string `gorm:"not null;default:''" json:"value"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SettingRepo interface {
Get(key SettingKey, defaultValue ...string) (string, error)
GetBool(key SettingKey, defaultValue ...bool) (bool, error)
GetInt(key SettingKey, defaultValue ...int) (int, error)
GetSlice(key SettingKey, defaultValue ...[]string) ([]string, error)
Set(key SettingKey, value string) error
SetSlice(key SettingKey, value []string) error
Delete(key SettingKey) error
GetPanel() (*request.SettingPanel, error)
UpdatePanel(req *request.SettingPanel) (bool, error)
UpdateCert(req *request.SettingCert) error
}