Files
rustdesk-api/config/rustdesk.go
T

31 lines
600 B
Go
Raw Permalink Normal View History

2024-09-13 15:57:29 +08:00
package config
2024-11-01 14:56:11 +08:00
import (
"os"
)
2024-09-13 15:57:29 +08:00
type Rustdesk struct {
IdServer string `mapstructure:"id-server"`
RelayServer string `mapstructure:"relay-server"`
ApiServer string `mapstructure:"api-server"`
Key string `mapstructure:"key"`
2024-11-01 14:56:11 +08:00
KeyFile string `mapstructure:"key-file"`
2024-09-24 14:43:27 +08:00
Personal int `mapstructure:"personal"`
2024-09-13 15:57:29 +08:00
}
2024-11-01 14:56:11 +08:00
func LoadKeyFile(rustdesk *Rustdesk) {
// Load key file
if rustdesk.Key != "" {
return
}
if rustdesk.KeyFile != "" {
// Load key from file
b, err := os.ReadFile(rustdesk.KeyFile)
if err != nil {
return
}
rustdesk.Key = string(b)
return
}
}