*: rename GitServer to Gitserver

This commit is contained in:
Simone Gotti 2019-05-08 15:23:13 +02:00
parent 1e34dca95d
commit 43341f2cba
5 changed files with 23 additions and 23 deletions

View File

@ -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")
}

View File

@ -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"

View File

@ -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")
}

View File

@ -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)

View File

@ -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)