Sponsor: fix machine id panic on startup with plant config (#29542)
This commit is contained in:
parent
1169a3c8b9
commit
516a6841bb
2 changed files with 6 additions and 3 deletions
|
|
@ -36,9 +36,12 @@ var (
|
|||
mu sync.RWMutex
|
||||
Subject, Token, ActivationKey string
|
||||
ExpiresAt time.Time
|
||||
machineID = machine.ProtectedID("evcc-sponsor")
|
||||
)
|
||||
|
||||
func machineID() string {
|
||||
return machine.ProtectedID("evcc-sponsor")
|
||||
}
|
||||
|
||||
const unavailable = "sponsorship unavailable"
|
||||
|
||||
func IsAuthorized() bool {
|
||||
|
|
@ -68,7 +71,7 @@ func ActivateSponsorship(licenseKey, email string) (string, error) {
|
|||
res, err := client.Activate(ctx, &pb.ActivateRequest{
|
||||
Key: licenseKey,
|
||||
Email: email,
|
||||
MachineId: machineID,
|
||||
MachineId: machineID(),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ func checkHardware(vendor string, metadata map[string]string) string {
|
|||
|
||||
client := pb.NewAuthClient(conn)
|
||||
res, err := client.IsAuthorizedHardware(ctx, &pb.HardwareRequest{
|
||||
MachineId: machineID,
|
||||
MachineId: machineID(),
|
||||
Vendor: vendor,
|
||||
Metadata: metadata,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue