Documentation
¶
Index ¶
- Variables
- func Db() *gorm.DB
- func InitDb(conf *Configuration) error
- func InitLanguage(lang string)
- func InitLogger(conf *Configuration) error
- func IsDevelopmentMode() bool
- func IsProductionMode() bool
- func IsTestMode() bool
- func ReloadConfig()
- func SaveSettings()
- func SideloadDataDir() string
- type AppMode
- type AppVersion
- type Configuration
- type SettingsConfiguration
- type TaskMode
Constants ¶
This section is empty.
Variables ¶
View Source
var Mode = AppMode(build.Mode)
View Source
var Version = AppVersion{ Commit: build.Commit, Version: build.Version, BuildDate: build.BuildDate, }
Functions ¶
func InitDb ¶ added in v0.2.0
func InitDb(conf *Configuration) error
func InitLanguage ¶ added in v0.2.0
func InitLanguage(lang string)
func InitLogger ¶ added in v0.2.0
func InitLogger(conf *Configuration) error
func IsDevelopmentMode ¶ added in v0.2.0
func IsDevelopmentMode() bool
func IsProductionMode ¶ added in v0.2.0
func IsProductionMode() bool
func IsTestMode ¶ added in v0.2.0
func IsTestMode() bool
func ReloadConfig ¶
func ReloadConfig()
func SaveSettings ¶ added in v0.2.0
func SaveSettings()
func SideloadDataDir ¶ added in v0.3.0
func SideloadDataDir() string
Types ¶
type AppVersion ¶ added in v0.2.0
type AppVersion struct {
Commit string `json:"commit"`
Version string `json:"version"`
BuildDate string `json:"build_date"`
}
Info holds build information
type Configuration ¶ added in v0.2.0
type Configuration struct {
App struct {
LockdownDir string `koanf:"lockdown_dir" default:"/var/lib/lockdown"`
DeveloperDiskImage struct {
ImageSource string `` /* 181-byte string literal not displayed */
CNProxy string `koanf:"cn_proxy" json:"cn_proxy" default:"https://mirror.ghproxy.com"`
} `koanf:"developer_disk_image" json:"developer_disk_image"`
} `koanf:"app" json:"app"`
Log struct {
Level string `koanf:"level" default:"info"`
TimeFormat string `koanf:"time_format" default:"2006-01-02 15:04:05.000"`
LogFile string `koanf:"log_file"`
AccessLog string `koanf:"access_log"`
} `koanf:"log" json:"log"`
Server struct {
ListenAddr string `koanf:"listen_addr" default:"0.0.0.0"`
Port int `koanf:"port" default:"9000"`
DataDir string `koanf:"work_dir"`
} `koanf:"server" json:"server"`
Db db.Config `koanf:"db" json:"db"`
}
configuration holds any kind of configuration that comes from the outside world and is necessary for running the application.
var (
Config *Configuration
)
func Cfg ¶
func Cfg() *Configuration
func InitConfig ¶ added in v0.2.0
func InitConfig(path string, debug bool) (*Configuration, error)
load config from file
type SettingsConfiguration ¶ added in v0.2.0
type SettingsConfiguration struct {
App struct {
Language string `koanf:"language" json:"language"`
} `koanf:"app" json:"app"`
Task struct {
Enabled bool `koanf:"enabled" json:"enabled" default:"true"`
IphoneEnabled bool `koanf:"iphone_enabled" json:"iphone_enabled" default:"true"`
Mode TaskMode `koanf:"mode" json:"mode" default:"1"`
CrodTime string `koanf:"crod_time" json:"crod_time" default:"0,30 3-6 * * *"`
} `koanf:"task" json:"task"`
Notification struct {
Enabled bool `koanf:"enabled" json:"enabled"`
Type string `koanf:"type" json:"type" default:"weixin"`
Telegram struct {
BotToken string `koanf:"bot_token" json:"bot_token"`
ChatID string `koanf:"chat_id" json:"chat_id"`
} `koanf:"telegram" json:"telegram"`
Weixin struct {
CorpID string `koanf:"corp_id" json:"corp_id"`
CorpSecret string `koanf:"corp_secret" json:"corp_secret"`
AgentID string `koanf:"agent_id" json:"agent_id"`
ToUser string `koanf:"to_user" json:"to_user"`
} `koanf:"weixin" json:"weixin"`
Bark struct {
BarkServer string `koanf:"bark_server" json:"bark_server" default:"https://api.day.app"`
DeviceKey string `koanf:"device_key" json:"device_key"`
} `koanf:"bark" json:"bark"`
Email struct {
SMTPHost string `koanf:"smtp_host" json:"smtp_host"`
SMTPPort int `koanf:"smtp_port" json:"smtp_port" default:"587"`
Username string `koanf:"username" json:"username"`
Password string `koanf:"password" json:"password"`
From string `koanf:"from" json:"from"`
To string `koanf:"to" json:"to"`
} `koanf:"email" json:"email"`
Webhook struct {
URL string `koanf:"url" json:"url"`
Method string `koanf:"method" json:"method" default:"POST"`
ContentType string `koanf:"content_type" json:"content_type" default:"application/json"`
Body string `koanf:"body" json:"body"`
} `koanf:"webhook" json:"webhook"`
} `koanf:"notification" json:"notification"`
Network struct {
ProxyEnabled bool `koanf:"proxy_enabled" json:"proxy_enabled"`
HTTPProxy string `koanf:"http_proxy" json:"http_proxy"`
HTTPSProxy string `koanf:"https_proxy" json:"https_proxy"`
} `koanf:"network" json:"network"`
}
var (
Settings *SettingsConfiguration
)
func InitSettings ¶ added in v0.2.0
func InitSettings(conf *Configuration, debug bool) (*SettingsConfiguration, error)
load settings from file
Source Files
¶
Click to show internal directories.
Click to hide internal directories.