mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-09 23:38:26 +00:00
Merge pull request #2677 from nrm21/default_sync
Added STNODEFAULTFOLDER envvar to skip default folder creation
This commit is contained in:
commit
1e52cc474f
@ -146,34 +146,38 @@ Development Settings
|
|||||||
The following environment variables modify syncthing's behavior in ways that
|
The following environment variables modify syncthing's behavior in ways that
|
||||||
are mostly useful for developers. Use with care.
|
are mostly useful for developers. Use with care.
|
||||||
|
|
||||||
STGUIASSETS Directory to load GUI assets from. Overrides compiled in
|
STNODEFAULTFOLDER Don't create a default folder when starting for the first
|
||||||
assets.
|
time. This variable will be ignored anytime after the first
|
||||||
|
run.
|
||||||
|
|
||||||
STTRACE A comma separated string of facilities to trace. The valid
|
STGUIASSETS Directory to load GUI assets from. Overrides compiled in
|
||||||
facility strings listed below.
|
assets.
|
||||||
|
|
||||||
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
STTRACE A comma separated string of facilities to trace. The valid
|
||||||
profiler with HTTP access.
|
facility strings listed below.
|
||||||
|
|
||||||
STCPUPROFILE Write a CPU profile to cpu-$pid.pprof on exit.
|
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
||||||
|
profiler with HTTP access.
|
||||||
|
|
||||||
STHEAPPROFILE Write heap profiles to heap-$pid-$timestamp.pprof each time
|
STCPUPROFILE Write a CPU profile to cpu-$pid.pprof on exit.
|
||||||
heap usage increases.
|
|
||||||
|
|
||||||
STBLOCKPROFILE Write block profiles to block-$pid-$timestamp.pprof every 20
|
STHEAPPROFILE Write heap profiles to heap-$pid-$timestamp.pprof each time
|
||||||
seconds.
|
heap usage increases.
|
||||||
|
|
||||||
STPERFSTATS Write running performance statistics to perf-$pid.csv. Not
|
STBLOCKPROFILE Write block profiles to block-$pid-$timestamp.pprof every 20
|
||||||
supported on Windows.
|
seconds.
|
||||||
|
|
||||||
STNOUPGRADE Disable automatic upgrades.
|
STPERFSTATS Write running performance statistics to perf-$pid.csv. Not
|
||||||
|
supported on Windows.
|
||||||
|
|
||||||
GOMAXPROCS Set the maximum number of CPU cores to use. Defaults to all
|
STNOUPGRADE Disable automatic upgrades.
|
||||||
available CPU cores.
|
|
||||||
|
|
||||||
GOGC Percentage of heap growth at which to trigger GC. Default is
|
GOMAXPROCS Set the maximum number of CPU cores to use. Defaults to all
|
||||||
100. Lower numbers keep peak memory usage down, at the price
|
available CPU cores.
|
||||||
of CPU usage (ie. performance).
|
|
||||||
|
GOGC Percentage of heap growth at which to trigger GC. Default is
|
||||||
|
100. Lower numbers keep peak memory usage down, at the price
|
||||||
|
of CPU usage (ie. performance).
|
||||||
|
|
||||||
|
|
||||||
Debugging Facilities
|
Debugging Facilities
|
||||||
@ -186,8 +190,9 @@ The following are valid values for the STTRACE variable:
|
|||||||
|
|
||||||
// Environment options
|
// Environment options
|
||||||
var (
|
var (
|
||||||
noUpgrade = os.Getenv("STNOUPGRADE") != ""
|
noUpgrade = os.Getenv("STNOUPGRADE") != ""
|
||||||
innerProcess = os.Getenv("STNORESTART") != "" || os.Getenv("STMONITORED") != ""
|
innerProcess = os.Getenv("STNORESTART") != "" || os.Getenv("STMONITORED") != ""
|
||||||
|
noDefaultFolder = os.Getenv("STNODEFAULTFOLDER") != ""
|
||||||
)
|
)
|
||||||
|
|
||||||
type RuntimeOptions struct {
|
type RuntimeOptions struct {
|
||||||
@ -990,18 +995,28 @@ func setupGUI(mainService *suture.Supervisor, cfg *config.Wrapper, m *model.Mode
|
|||||||
}
|
}
|
||||||
|
|
||||||
func defaultConfig(myName string) config.Configuration {
|
func defaultConfig(myName string) config.Configuration {
|
||||||
defaultFolder := config.NewFolderConfiguration("default", locations[locDefFolder])
|
var defaultFolder config.FolderConfiguration
|
||||||
defaultFolder.RescanIntervalS = 60
|
|
||||||
defaultFolder.MinDiskFreePct = 1
|
if !noDefaultFolder {
|
||||||
defaultFolder.Devices = []config.FolderDeviceConfiguration{{DeviceID: myID}}
|
l.Infoln("Default folder created and/or linked to new config")
|
||||||
defaultFolder.AutoNormalize = true
|
|
||||||
defaultFolder.MaxConflicts = -1
|
defaultFolder = config.NewFolderConfiguration("default", locations[locDefFolder])
|
||||||
|
defaultFolder.RescanIntervalS = 60
|
||||||
|
defaultFolder.MinDiskFreePct = 1
|
||||||
|
defaultFolder.Devices = []config.FolderDeviceConfiguration{{DeviceID: myID}}
|
||||||
|
defaultFolder.AutoNormalize = true
|
||||||
|
defaultFolder.MaxConflicts = -1
|
||||||
|
} else {
|
||||||
|
l.Infoln("We will skip creation of a default folder on first start since the proper envvar is set")
|
||||||
|
}
|
||||||
|
|
||||||
thisDevice := config.NewDeviceConfiguration(myID, myName)
|
thisDevice := config.NewDeviceConfiguration(myID, myName)
|
||||||
thisDevice.Addresses = []string{"dynamic"}
|
thisDevice.Addresses = []string{"dynamic"}
|
||||||
|
|
||||||
newCfg := config.New(myID)
|
newCfg := config.New(myID)
|
||||||
newCfg.Folders = []config.FolderConfiguration{defaultFolder}
|
if !noDefaultFolder {
|
||||||
|
newCfg.Folders = []config.FolderConfiguration{defaultFolder}
|
||||||
|
}
|
||||||
newCfg.Devices = []config.DeviceConfiguration{thisDevice}
|
newCfg.Devices = []config.DeviceConfiguration{thisDevice}
|
||||||
|
|
||||||
port, err := getFreePort("127.0.0.1", 8384)
|
port, err := getFreePort("127.0.0.1", 8384)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user