Files
backend/global/global.go
T
NanamiAdmin 5c748dafcd fix(user): allow re-login by removing existing session if user is already logged in
fix(main): conditionally initialize and connect to watchdog based on configuration

fix(instance): remove unused userID variable and commented debug logs in ListInstancesHandler
2026-05-10 21:54:49 +08:00

97 lines
1.8 KiB
Go

package global
import (
"database/sql"
)
var ConfigPath *string
var DBPath_data *string
var DBPath_log *string
type SoftwareInfo struct {
Name string
Version string
Developer string
BuildVer int16
Description string
BuildType string
}
var Software = SoftwareInfo{
Name: "Super-frpc",
Version: "0.0.1",
Developer: "Madobi Nanami",
BuildVer: 1,
BuildType: "release",
}
type StatusFlags struct {
Debug bool
Online bool
WatchdogConnected bool
}
var (
ConfigDB *sql.DB
FrpcDB *sql.DB
LogsDB *sql.DB
)
var Is = StatusFlags{
Debug: false,
Online: false,
WatchdogConnected: false,
}
type Config struct {
ListenAddr string `json:"listenAddr"`
ListenPort string `json:"listenPort"`
FrpcPath string `json:"frpcPath"`
InstancePath string `json:"instancePath"`
Debug bool `json:"debug"`
Watchdog struct {
Enabled bool `json:"enabled"`
} `json:"watchdog"`
Notification struct {
Enabled bool `json:"enabled"`
Method string `json:"method"`
} `json:"notification"`
Webhook struct {
Method string `json:"method"`
URL string `json:"url"`
Headers string `json:"headers"`
Body string `json:"body"`
} `json:"webhook"`
}
var CurrentConfig = Config{
ListenAddr: "0.0.0.0",
ListenPort: "7000",
FrpcPath: "",
InstancePath: "",
Debug: false,
Watchdog: struct {
Enabled bool `json:"enabled"`
}{
Enabled: false,
},
Notification: struct {
Enabled bool `json:"enabled"`
Method string `json:"method"`
}{
Enabled: false,
Method: "webhook",
},
Webhook: struct {
Method string `json:"method"`
URL string `json:"url"`
Headers string `json:"headers"`
Body string `json:"body"`
}{
Method: "",
URL: "",
Headers: "Content-Type: application/json",
Body: "",
},
}