From 4d5c8107867587dede51eac688280de20734b4d1 Mon Sep 17 00:00:00 2001 From: Greg Date: Sun, 29 Jun 2025 18:38:39 +0200 Subject: [PATCH] mysql --- config.go | 4 +++- config.yml | 2 +- flexradio.go | 6 +++--- main.go | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config.go b/config.go index 0fe4629..7b1d88c 100644 --- a/config.go +++ b/config.go @@ -14,10 +14,12 @@ type Config struct { General struct { DeleteLogFileAtStart bool `yaml:"delete_log_file_at_start"` LogToFile bool `yaml:"log_to_file"` + Callsign string `yaml:"callsign"` LogLevel string `yaml:"log_level"` TelnetServer bool `yaml:"telnetserver"` FlexRadioSpot bool `yaml:"flexradiospot"` } `yaml:"general"` + Database struct { MySQL bool `yaml:"mysql"` SQLite bool `yaml:"sqlite"` @@ -27,9 +29,9 @@ type Config struct { MySQLHost string `yaml:"mysql_host"` MySQLPort string `yaml:"mysql_port"` } `yaml:"database"` + SQLite struct { SQLitePath string `yaml:"sqlite_path"` - Callsign string `yaml:"callsign"` } `yaml:"sqlite"` Cluster struct { diff --git a/config.yml b/config.yml index 3630689..2e33df6 100644 --- a/config.yml +++ b/config.yml @@ -1,5 +1,6 @@ general: delete_log_file_at_start: true + callsign: F4BPO # Log4OM Callsign used to check if you get spotted by someone log_to_file: true log_level: DEBUG # INFO or DEBUG or WARN telnetserver: true # not in use for now @@ -14,7 +15,6 @@ database: mysql_port: 3306 sqlite: sqlite_path: 'C:\Perso\Seafile\Radio\Logs\Log4OM\F4BPO.SQLite' # SQLite Db oath of Log4OM - callsign: F4BPO # Log4OM Callsign used to check if you get spotted by someone cluster: server: cluster.f4bpo.com # dxc.k0xm.net dxc.sm7iun.se port: 7300 diff --git a/flexradio.go b/flexradio.go index 7335e4f..6ff1021 100644 --- a/flexradio.go +++ b/flexradio.go @@ -177,7 +177,7 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) { flexSpot.Priority = "1" flexSpot.BackgroundColor = "#ff000000" flexSpot.Comment = flexSpot.Comment + " [New DXCC]" - } else if spot.DX == Cfg.SQLite.Callsign { + } else if spot.DX == Cfg.General.Callsign { flexSpot.Color = "#ffff0000" flexSpot.Priority = "1" flexSpot.BackgroundColor = "#ff000000" @@ -286,10 +286,10 @@ func (fc *FlexClient) ReadLine() { Log.Errorf("could not find spot by flex spot number in database: %s", err) } - msg := fmt.Sprintf(`To ALL de %s <%s> : Clicked on "%s" at %s`, Cfg.SQLite.Callsign, spot.UTCTime, spot.DX, spot.FrequencyHz) + msg := fmt.Sprintf(`To ALL de %s <%s> : Clicked on "%s" at %s`, Cfg.General.Callsign, spot.UTCTime, spot.DX, spot.FrequencyHz) if len(fc.TCPServer.Clients) > 0 { fc.MsgChan <- msg - Log.Infof("%s clicked on spot \"%s\" at %s", Cfg.SQLite.Callsign, spot.DX, spot.FrequencyMhz) + Log.Infof("%s clicked on spot \"%s\" at %s", Cfg.General.Callsign, spot.DX, spot.FrequencyMhz) } } diff --git a/main.go b/main.go index 7eaa146..5dc7d87 100644 --- a/main.go +++ b/main.go @@ -43,7 +43,7 @@ func main() { log := NewLog() log.Info("Running FlexDXCluster version 0.6") - log.Infof("Callsign: %s", cfg.SQLite.Callsign) + log.Infof("Callsign: %s", cfg.General.Callsign) DeleteDatabase("./flex.sqlite", log)