all: Refactor preparing configuration (#7127)
This commit is contained in:
@@ -11,6 +11,8 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/rand"
|
||||
)
|
||||
|
||||
func (c GUIConfiguration) IsAuthEnabled() bool {
|
||||
@@ -126,6 +128,12 @@ func (c GUIConfiguration) IsValidAPIKey(apiKey string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *GUIConfiguration) prepare() {
|
||||
if c.APIKey == "" {
|
||||
c.APIKey = rand.String(32)
|
||||
}
|
||||
}
|
||||
|
||||
func (c GUIConfiguration) Copy() GUIConfiguration {
|
||||
return c
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user