cmd/syncthing: Extract interfaces for things the API depends on

Enables testing of the API service, in the long run.
This commit is contained in:
Jakob Borg
2016-03-21 19:36:08 +00:00
parent 894ccd18ff
commit a492cfba13
10 changed files with 112 additions and 51 deletions

View File

@@ -739,7 +739,7 @@ func syncthingMain(runtimeOptions RuntimeOptions) {
// Start relay management
var relayService *relay.Service
var relayService relay.Service
if opts.RelaysEnabled {
relayService = relay.NewService(cfg, tlsCfg)
mainService.Add(relayService)
@@ -972,7 +972,7 @@ func startAuditing(mainService *suture.Supervisor) {
l.Infoln("Audit log in", auditFile)
}
func setupGUI(mainService *suture.Supervisor, cfg *config.Wrapper, m *model.Model, apiSub *events.BufferedSubscription, discoverer *discover.CachingMux, relayService *relay.Service, errors, systemLog *logger.Recorder, runtimeOptions RuntimeOptions) {
func setupGUI(mainService *suture.Supervisor, cfg *config.Wrapper, m *model.Model, apiSub events.BufferedSubscription, discoverer discover.CachingMux, relayService relay.Service, errors, systemLog logger.Recorder, runtimeOptions RuntimeOptions) {
guiCfg := cfg.GUI()
if !guiCfg.Enabled {