Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitbucketConfig ¶
type BitbucketConfig struct { Username string `yaml:"username"` Password string `yaml:"password"` Repositories []string `yaml:"repositories"` Projects []string `yaml:"projects"` Team string `yaml:"team"` FindUsersInTeam bool `yaml:"find_users_in_team"` }
BitbucketConfig represents a team's bitbucket configuration
type EnvironmentConfig ¶
type EnvironmentConfig struct { ConfigFilePath string `envconfig:"config"` LogLevel string `envconfig:"log_level"` BitbucketUsername string `envconfig:"bitbucket_username"` BitbucketPassword string `envconfig:"bitbucket_password"` GithubToken string `envconfig:"github_token"` SlackToken string `envconfig:"slack_token"` }
EnvironmentConfig represents all configurations that can be set using environment variables
type GithubConfig ¶
type GithubConfig struct { Repositories []string `yaml:"repositories"` Token string `yaml:"token"` }
GithubConfig represents a team's github configuration
type GlobalConfig ¶
type GlobalConfig struct {
Teams []*TeamConfig
}
GlobalConfig represents the read configuration file
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader represents an utility that will read the configuration from the environment as well as a config file
func (*Reader) ReadConfig ¶
func (configReader *Reader) ReadConfig() (config *GlobalConfig, err error)
ReadConfig reads the configuration file at the given path and injects environment variables in the read configuration (team configs)
type SlackConfig ¶
type SlackConfig struct { Channel string `yaml:"channel"` MessageUsersIndividually bool `yaml:"message_users_individually"` Token string `yaml:"token"` DebugUser string `yaml:"debug_user"` }
SlackConfig represents a team's slack configuration
type TeamConfig ¶
type TeamConfig struct { Name string `yaml:"name"` AgeBeforeNotifying time.Duration `yaml:"age_before_notifying"` NumberOfApprovals int `yaml:"number_of_approvals"` ReviewPRsFromNonMembers bool `yaml:"review_pr_from_non_members"` Hosts struct { Bitbucket BitbucketConfig `yaml:"bitbucket"` Github GithubConfig `yaml:"github"` } Messaging struct { Slack SlackConfig `yaml:"slack"` } Users []User `yaml:"users"` }
TeamConfig represents the full configuration needed to handle a team. Since teams are all independent, this struct is passed to all handlers and it needs to contain all the necessary information to do the whole job
func (*TeamConfig) GetGithubUsers ¶
func (config *TeamConfig) GetGithubUsers() map[string]User
GetGithubUsers returns a map of all github users'
func (*TeamConfig) GetNumberOfNeededApprovals ¶
func (config *TeamConfig) GetNumberOfNeededApprovals() int
GetNumberOfNeededApprovals returns the number of approvals needed for a pull request to be considered accepted. It simply returns the configured number with a minimum of 1
func (*TeamConfig) IsBitbucketConfigured ¶
func (config *TeamConfig) IsBitbucketConfigured() bool
IsBitbucketConfigured returns true if all necessary configurations are set to handle Bitbucket
func (*TeamConfig) IsGithubConfigured ¶
func (config *TeamConfig) IsGithubConfigured() bool
IsGithubConfigured returns true if all necessary configurations are set to handle Github