From 43341f2cba839cee4b12da1307d6fbf61900d636 Mon Sep 17 00:00:00 2001 From: Simone Gotti Date: Wed, 8 May 2019 15:23:13 +0200 Subject: [PATCH] *: rename GitServer to Gitserver --- cmd/agola/cmd/serve.go | 12 ++++++------ examples/config.yml | 8 ++++---- internal/services/config/config.go | 12 ++++++------ internal/services/gateway/gateway.go | 2 +- internal/services/gitserver/main.go | 12 ++++++------ 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cmd/agola/cmd/serve.go b/cmd/agola/cmd/serve.go index c7c0592..5ba5f64 100644 --- a/cmd/agola/cmd/serve.go +++ b/cmd/agola/cmd/serve.go @@ -43,8 +43,8 @@ var componentsNames = []string{ "all", "gateway", "scheduler", - "runservicescheduler", - "runserviceexecutor", + "runservice", + "executor", "configstore", "gitserver", } @@ -140,7 +140,7 @@ func serve(cmd *cobra.Command, args []string) error { } var rs *rsscheduler.Runservice - if isComponentEnabled("runservicescheduler") { + if isComponentEnabled("runservice") { rs, err = rsscheduler.NewRunservice(ctx, &c.Runservice) if err != nil { return errors.Wrapf(err, "failed to start run service scheduler") @@ -148,7 +148,7 @@ func serve(cmd *cobra.Command, args []string) error { } var ex *rsexecutor.Executor - if isComponentEnabled("runserviceexecutor") { + if isComponentEnabled("executor") { ex, err = executor.NewExecutor(&c.Executor) if err != nil { return errors.Wrapf(err, "failed to start run service executor") @@ -179,9 +179,9 @@ func serve(cmd *cobra.Command, args []string) error { } } - var gs *gitserver.GitServer + var gs *gitserver.Gitserver if isComponentEnabled("gitserver") { - gs, err = gitserver.NewGitServer(&c.GitServer) + gs, err = gitserver.NewGitserver(&c.Gitserver) if err != nil { return errors.Wrapf(err, "failed to start git server") } diff --git a/examples/config.yml b/examples/config.yml index 1356e1e..01d6019 100644 --- a/examples/config.yml +++ b/examples/config.yml @@ -3,7 +3,7 @@ gateway: webExposedURL: "http://172.17.0.1:8080" runserviceURL: "http://localhost:4000" configstoreURL: "http://localhost:4002" - gitServerURL: "http://172.17.0.1:4003" + gitserverURL: "http://172.17.0.1:4003" web: listenAddress: ":8000" @@ -33,11 +33,11 @@ configstore: runservice: #debug: true dataDir: /tmp/agola/runservice + etcd: + endpoints: "http://localhost:2379" objectStorage: type: posix path: /tmp/agola/runservice/ost - etcd: - endpoints: "http://localhost:2379" web: listenAddress: ":4000" @@ -51,7 +51,7 @@ executor: driver: type: docker -gitServer: +gitserver: dataDir: /tmp/agola/gitserver githookPath: ./bin/agola-git-hook gatewayURL: "http://localhost:8000" diff --git a/internal/services/config/config.go b/internal/services/config/config.go index dffb16d..9d4e97a 100644 --- a/internal/services/config/config.go +++ b/internal/services/config/config.go @@ -38,7 +38,7 @@ type Config struct { Runservice Runservice `yaml:"runservice"` Executor Executor `yaml:"executor"` Configstore Configstore `yaml:"configstore"` - GitServer GitServer `yaml:"gitServer"` + Gitserver Gitserver `yaml:"gitserver"` } type Gateway struct { @@ -53,7 +53,7 @@ type Gateway struct { RunserviceURL string `yaml:"runserviceURL"` ConfigstoreURL string `yaml:"configstoreURL"` - GitServerURL string `yaml:"gitServerURL"` + GitserverURL string `yaml:"gitserverURL"` Web Web `yaml:"web"` Etcd Etcd `yaml:"etcd"` @@ -108,7 +108,7 @@ type Configstore struct { ObjectStorage ObjectStorage `yaml:"objectStorage"` } -type GitServer struct { +type Gitserver struct { Debug bool `yaml:"debug"` DataDir string `yaml:"dataDir"` @@ -315,13 +315,13 @@ func Validate(c *Config) error { } // Git server - if c.GitServer.DataDir == "" { + if c.Gitserver.DataDir == "" { return errors.Errorf("git server dataDir is empty") } - if c.GitServer.GithookPath == "" { + if c.Gitserver.GithookPath == "" { return errors.Errorf("git server githookPath is empty") } - if c.GitServer.GatewayURL == "" { + if c.Gitserver.GatewayURL == "" { return errors.Errorf("git server gatewayURL is empty") } diff --git a/internal/services/gateway/gateway.go b/internal/services/gateway/gateway.go index efa3241..8fa7daf 100644 --- a/internal/services/gateway/gateway.go +++ b/internal/services/gateway/gateway.go @@ -195,7 +195,7 @@ func (g *Gateway) Run(ctx context.Context) error { logsHandler := api.NewLogsHandler(logger, g.ah) - reposHandler := api.NewReposHandler(logger, g.c.GitServerURL) + reposHandler := api.NewReposHandler(logger, g.c.GitserverURL) userRemoteReposHandler := api.NewUserRemoteReposHandler(logger, g.ah, g.configstoreClient) loginUserHandler := api.NewLoginUserHandler(logger, g.ah) diff --git a/internal/services/gitserver/main.go b/internal/services/gitserver/main.go index 368e6f2..7307a4c 100644 --- a/internal/services/gitserver/main.go +++ b/internal/services/gitserver/main.go @@ -127,7 +127,7 @@ func Matcher(matchRegexp *regexp.Regexp) mux.MatcherFunc { } } -func (s *GitServer) repoPostCreateFunc(githookPath, gatewayURL string) handlers.RepoPostCreateFunc { +func (s *Gitserver) repoPostCreateFunc(githookPath, gatewayURL string) handlers.RepoPostCreateFunc { return func(repoPath, repoAbsPath string) error { f, err := os.OpenFile(filepath.Join(repoAbsPath, "hooks/post-receive"), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0760) if err != nil { @@ -154,11 +154,11 @@ func (s *GitServer) repoPostCreateFunc(githookPath, gatewayURL string) handlers. } } -type GitServer struct { - c *config.GitServer +type Gitserver struct { + c *config.Gitserver } -func NewGitServer(c *config.GitServer) (*GitServer, error) { +func NewGitserver(c *config.Gitserver) (*Gitserver, error) { if c.Debug { level.SetLevel(zapcore.DebugLevel) } @@ -176,12 +176,12 @@ func NewGitServer(c *config.GitServer) (*GitServer, error) { c.GithookPath = path } - return &GitServer{ + return &Gitserver{ c: c, }, nil } -func (s *GitServer) Run(ctx context.Context) error { +func (s *Gitserver) Run(ctx context.Context) error { gitSmartHandler := handlers.NewGitSmartHandler(logger, s.c.DataDir, true, repoAbsPath, s.repoPostCreateFunc(s.c.GithookPath, s.c.GatewayURL)) fetchFileHandler := handlers.NewFetchFileHandler(logger, s.c.DataDir, repoAbsPath)