Remove some deprecated config fields

- gpsd_addr: Use gpsd.addr instead.
- serial_tnc.baudrate: Use serial_tnc.hbaud instead.
This commit is contained in:
Martin Hebnes Pedersen 2026-01-30 19:17:25 +01:00
parent 68edaee8e9
commit 98f9968bd5
2 changed files with 2 additions and 23 deletions

View file

@ -15,7 +15,6 @@ import (
"github.com/kelseyhightower/envconfig"
"github.com/la5nta/pat/cfg"
"github.com/la5nta/pat/internal/buildinfo"
"github.com/la5nta/pat/internal/debug"
)
func LoadConfig(cfgPath string, fallback cfg.Config) (config cfg.Config, err error) {
@ -111,11 +110,6 @@ func LoadConfig(cfgPath string, fallback cfg.Config) (config cfg.Config, err err
if config.GPSd == (cfg.GPSdConfig{}) {
config.GPSd = cfg.DefaultConfig.GPSd
}
// TODO: Remove after some release cycles (2019-09-29)
if v := config.GPSdAddrLegacy; v != "" && v != config.GPSd.Addr {
log.Println("Using deprecated configuration option gpsd_addr. Please set gpsd.addr instead.")
config.GPSd.Addr = v
}
// Ensure SerialTNC has a default hbaud and serialbaud
if config.SerialTNC.HBaud == 0 {
@ -124,12 +118,6 @@ func LoadConfig(cfgPath string, fallback cfg.Config) (config cfg.Config, err err
if config.SerialTNC.SerialBaud == 0 {
config.SerialTNC.SerialBaud = cfg.DefaultConfig.SerialTNC.SerialBaud
}
// Compatibility for the old baudrate field for serial-tnc
if v := config.SerialTNC.BaudrateLegacy; v != 0 && v != config.SerialTNC.HBaud {
// Since we changed the default value from 9600 to 1200, we can't warn about this without causing confusion.
debug.Printf("Legacy serial_tnc.baudrate config detected (%d). Translating to serial_tnc.hbaud.", v)
config.SerialTNC.HBaud = v
}
// Compatibility for old type default 'Kenwood' (should be 'kenwood')
if v := config.SerialTNC.Type; v == "Kenwood" {
config.SerialTNC.Type = strings.ToLower(v)

View file

@ -112,10 +112,6 @@ type Config struct {
// See PredictionConfig.
Prediction PredictionConfig `json:"prediction,omitzero"`
// Legacy support for old config files only. This field is deprecated!
// Please use "Addr" field in GPSd config struct (GPSd.Addr)
GPSdAddrLegacy string `json:"gpsd_addr,omitempty"`
// Command schedule (cron-like syntax).
//
// Examples:
@ -314,10 +310,6 @@ type SerialTNCConfig struct {
// HBaud is the the packet connection's baudrate (1200 or 9600).
HBaud int `json:"hbaud"`
// Baudrate of the packet connection.
// Deprecated: Use HBaud instead.
BaudrateLegacy int `json:"baudrate,omitempty"`
// Type of TNC (currently only 'kenwood').
Type string `json:"type"`
}
@ -448,7 +440,6 @@ var DefaultConfig = Config{
UpdateLocator: false,
Addr: "localhost:2947", // Default listen address for GPSd
},
GPSdAddrLegacy: "",
Schedule: map[string]string{},
HamlibRigs: map[string]HamlibConfig{},
Schedule: map[string]string{},
HamlibRigs: map[string]HamlibConfig{},
}