move secret and registry init to helper func

This commit is contained in:
Brad Rydzewski 2017-05-07 18:47:06 +02:00
parent a540f8fa00
commit d5dc9a8894
2 changed files with 15 additions and 7 deletions

View file

@ -398,8 +398,8 @@ func setupEvilGlobals(c *cli.Context, v store.Store) {
droneserver.Config.Services.Logs = logging.New() droneserver.Config.Services.Logs = logging.New()
droneserver.Config.Services.Pubsub = pubsub.New() droneserver.Config.Services.Pubsub = pubsub.New()
droneserver.Config.Services.Pubsub.Create(context.Background(), "topic/events") droneserver.Config.Services.Pubsub.Create(context.Background(), "topic/events")
droneserver.Config.Services.Registries = registry.New(v) droneserver.Config.Services.Registries = setupRegistryService(c, v)
droneserver.Config.Services.Secrets = secrets.New(v) droneserver.Config.Services.Secrets = setupSecretService(c, v)
droneserver.Config.Services.Senders = sender.New(v, v) droneserver.Config.Services.Senders = sender.New(v, v)
if endpoint := c.String("registry-service"); endpoint != "" { if endpoint := c.String("registry-service"); endpoint != "" {
droneserver.Config.Services.Registries = registry.NewRemote(endpoint) droneserver.Config.Services.Registries = registry.NewRemote(endpoint)

View file

@ -5,6 +5,8 @@ package server
import ( import (
"github.com/cncd/queue" "github.com/cncd/queue"
"github.com/drone/drone/model" "github.com/drone/drone/model"
"github.com/drone/drone/plugins/registry"
"github.com/drone/drone/plugins/secrets"
"github.com/drone/drone/store" "github.com/drone/drone/store"
"github.com/drone/drone/store/datastore" "github.com/drone/drone/store/datastore"
@ -22,8 +24,14 @@ func setupQueue(c *cli.Context, s store.Store) queue.Queue {
return model.WithTaskStore(queue.New(), s) return model.WithTaskStore(queue.New(), s)
} }
func setupPubsub(c *cli.Context) {} func setupSecretService(c *cli.Context, s store.Store) model.SecretService {
func setupStream(c *cli.Command) {} return secrets.New(s)
func setupRegistryService(c *cli.Command) {} }
func setupSecretService(c *cli.Command) {}
func setupGatingService(c *cli.Command) {} func setupRegistryService(c *cli.Context, s store.Store) model.RegistryService {
return registry.New(s)
}
func setupPubsub(c *cli.Context) {}
func setupStream(c *cli.Command) {}
func setupGatingService(c *cli.Command) {}