From d5dc9a88947b73c28dc6615d1afe81d464726f73 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Sun, 7 May 2017 18:47:06 +0200 Subject: [PATCH] move secret and registry init to helper func --- drone/server/server.go | 4 ++-- drone/server/setup.go | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drone/server/server.go b/drone/server/server.go index 25ac5204..acd818ff 100644 --- a/drone/server/server.go +++ b/drone/server/server.go @@ -398,8 +398,8 @@ func setupEvilGlobals(c *cli.Context, v store.Store) { droneserver.Config.Services.Logs = logging.New() droneserver.Config.Services.Pubsub = pubsub.New() droneserver.Config.Services.Pubsub.Create(context.Background(), "topic/events") - droneserver.Config.Services.Registries = registry.New(v) - droneserver.Config.Services.Secrets = secrets.New(v) + droneserver.Config.Services.Registries = setupRegistryService(c, v) + droneserver.Config.Services.Secrets = setupSecretService(c, v) droneserver.Config.Services.Senders = sender.New(v, v) if endpoint := c.String("registry-service"); endpoint != "" { droneserver.Config.Services.Registries = registry.NewRemote(endpoint) diff --git a/drone/server/setup.go b/drone/server/setup.go index 03f7938c..850c3fd3 100644 --- a/drone/server/setup.go +++ b/drone/server/setup.go @@ -5,6 +5,8 @@ package server import ( "github.com/cncd/queue" "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/datastore" @@ -22,8 +24,14 @@ func setupQueue(c *cli.Context, s store.Store) queue.Queue { return model.WithTaskStore(queue.New(), s) } -func setupPubsub(c *cli.Context) {} -func setupStream(c *cli.Command) {} -func setupRegistryService(c *cli.Command) {} -func setupSecretService(c *cli.Command) {} -func setupGatingService(c *cli.Command) {} +func setupSecretService(c *cli.Context, s store.Store) model.SecretService { + return secrets.New(s) +} + +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) {}