summaryrefslogtreecommitdiff
path: root/cmd/check/command/command.go
blob: 49e17c62e8cf9ea1ac8eb9c09af3e060ba9cd4c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package command

import (
	"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command"
	"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/healthcheck"
	"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/readwriter"
	"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/shared/disallowedcommand"
	"gitlab.com/gitlab-org/gitlab-shell/v14/internal/config"
)

func New(config *config.Config, readWriter *readwriter.ReadWriter) (command.Command, error) {
	if cmd := build(config, readWriter); cmd != nil {
		return cmd, nil
	}

	return nil, disallowedcommand.Error
}

func build(config *config.Config, readWriter *readwriter.ReadWriter) command.Command {
	return &healthcheck.Command{Config: config, ReadWriter: readWriter}
}