func defaultConfig(myName string) config.Configuration { var defaultFolder config.FolderConfiguration if !noDefaultFolder { l.Infoln("Default folder created and/or linked to new config") 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.Addresses = []string{"dynamic"} newCfg := config.New(myID) if !noDefaultFolder { newCfg.Folders = []config.FolderConfiguration{defaultFolder} } newCfg.Devices = []config.DeviceConfiguration{thisDevice} port, err := getFreePort("127.0.0.1", 8384) if err != nil { l.Fatalln("get free port (GUI):", err) } newCfg.GUI.RawAddress = fmt.Sprintf("127.0.0.1:%d", port) port, err = getFreePort("0.0.0.0", 22000) if err != nil { l.Fatalln("get free port (BEP):", err) } newCfg.Options.ListenAddress = []string{fmt.Sprintf("tcp://0.0.0.0:%d", port)} return newCfg }