mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
lib/config: Minor attribute updates
As discussed in https://github.com/syncthing/docs/pull/169 GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3082
This commit is contained in:
parent
1be40cc4fa
commit
b993b41847
@ -59,7 +59,7 @@ func TestDefaultValues(t *testing.T) {
|
|||||||
URPostInsecurely: false,
|
URPostInsecurely: false,
|
||||||
ReleasesURL: "https://api.github.com/repos/syncthing/syncthing/releases?per_page=30",
|
ReleasesURL: "https://api.github.com/repos/syncthing/syncthing/releases?per_page=30",
|
||||||
AlwaysLocalNets: []string{},
|
AlwaysLocalNets: []string{},
|
||||||
OverwriteNames: false,
|
OverwriteRemoteDevNames: false,
|
||||||
TempIndexMinBlocks: 10,
|
TempIndexMinBlocks: 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ func TestOverriddenValues(t *testing.T) {
|
|||||||
URPostInsecurely: true,
|
URPostInsecurely: true,
|
||||||
ReleasesURL: "https://localhost/releases",
|
ReleasesURL: "https://localhost/releases",
|
||||||
AlwaysLocalNets: []string{},
|
AlwaysLocalNets: []string{},
|
||||||
OverwriteNames: true,
|
OverwriteRemoteDevNames: true,
|
||||||
TempIndexMinBlocks: 100,
|
TempIndexMinBlocks: 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ type FolderConfiguration struct {
|
|||||||
Invalid string `xml:"-" json:"invalid"` // Set at runtime when there is an error, not saved
|
Invalid string `xml:"-" json:"invalid"` // Set at runtime when there is an error, not saved
|
||||||
cachedPath string
|
cachedPath string
|
||||||
|
|
||||||
DeprecatedReadOnly bool `xml:"ro,attr" json:"-"`
|
DeprecatedReadOnly bool `xml:"ro,attr,omitempty" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FolderDeviceConfiguration struct {
|
type FolderDeviceConfiguration struct {
|
||||||
|
@ -37,7 +37,7 @@ type OptionsConfiguration struct {
|
|||||||
MinHomeDiskFreePct float64 `xml:"minHomeDiskFreePct" json:"minHomeDiskFreePct" default:"1"`
|
MinHomeDiskFreePct float64 `xml:"minHomeDiskFreePct" json:"minHomeDiskFreePct" default:"1"`
|
||||||
ReleasesURL string `xml:"releasesURL" json:"releasesURL" default:"https://api.github.com/repos/syncthing/syncthing/releases?per_page=30"`
|
ReleasesURL string `xml:"releasesURL" json:"releasesURL" default:"https://api.github.com/repos/syncthing/syncthing/releases?per_page=30"`
|
||||||
AlwaysLocalNets []string `xml:"alwaysLocalNet" json:"alwaysLocalNets"`
|
AlwaysLocalNets []string `xml:"alwaysLocalNet" json:"alwaysLocalNets"`
|
||||||
OverwriteNames bool `xml:"overwriteNames" json:"overwriteNames" default:"false"`
|
OverwriteRemoteDevNames bool `xml:"overwriteRemoteDeviceNamesOnConnect" json:"overwriteRemoteDeviceNamesOnConnect" default:"false"`
|
||||||
TempIndexMinBlocks int `xml:"tempIndexMinBlocks" json:"tempIndexMinBlocks" default:"10"`
|
TempIndexMinBlocks int `xml:"tempIndexMinBlocks" json:"tempIndexMinBlocks" default:"10"`
|
||||||
|
|
||||||
DeprecatedUPnPEnabled bool `xml:"upnpEnabled" json:"-"`
|
DeprecatedUPnPEnabled bool `xml:"upnpEnabled" json:"-"`
|
||||||
|
2
lib/config/testdata/overridenvalues.xml
vendored
2
lib/config/testdata/overridenvalues.xml
vendored
@ -32,7 +32,7 @@
|
|||||||
<urInitialDelayS>800</urInitialDelayS>
|
<urInitialDelayS>800</urInitialDelayS>
|
||||||
<urPostInsecurely>true</urPostInsecurely>
|
<urPostInsecurely>true</urPostInsecurely>
|
||||||
<releasesURL>https://localhost/releases</releasesURL>
|
<releasesURL>https://localhost/releases</releasesURL>
|
||||||
<overwriteNames>true</overwriteNames>
|
<overwriteRemoteDeviceNamesOnConnect>true</overwriteRemoteDeviceNamesOnConnect>
|
||||||
<tempIndexMinBlocks>100</tempIndexMinBlocks>
|
<tempIndexMinBlocks>100</tempIndexMinBlocks>
|
||||||
</options>
|
</options>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -1048,7 +1048,7 @@ func (m *Model) AddConnection(conn connections.Connection, hello protocol.HelloM
|
|||||||
m.pmut.Unlock()
|
m.pmut.Unlock()
|
||||||
|
|
||||||
device, ok := m.cfg.Devices()[deviceID]
|
device, ok := m.cfg.Devices()[deviceID]
|
||||||
if ok && (device.Name == "" || m.cfg.Options().OverwriteNames) {
|
if ok && (device.Name == "" || m.cfg.Options().OverwriteRemoteDevNames) {
|
||||||
device.Name = hello.DeviceName
|
device.Name = hello.DeviceName
|
||||||
m.cfg.SetDevice(device)
|
m.cfg.SetDevice(device)
|
||||||
m.cfg.Save()
|
m.cfg.Save()
|
||||||
|
@ -386,7 +386,7 @@ func TestDeviceRename(t *testing.T) {
|
|||||||
m.Close(device1, protocol.ErrTimeout)
|
m.Close(device1, protocol.ErrTimeout)
|
||||||
|
|
||||||
opts := cfg.Options()
|
opts := cfg.Options()
|
||||||
opts.OverwriteNames = true
|
opts.OverwriteRemoteDevNames = true
|
||||||
cfg.SetOptions(opts)
|
cfg.SetOptions(opts)
|
||||||
|
|
||||||
hello.DeviceName = "tester2"
|
hello.DeviceName = "tester2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user