mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-09 11:58:36 +00:00
This flag can be set to either branch (default) or merge. If set to branch, we will check out the head branch of the pull request (the source). If set to merge, we will check out the base branch of the pull request (the destination) and then attempt to perform a git merge of the pull request branch. This simulates what will happen if the pull request is merged. This allows us to perform terraform commands on what the state of the repo will be *after* the pull request is merged. This is useful if users are often opening up pull requests from branches that aren't up to date with master. With the branch strategy, the terraform plan might be deleting resources that have been created in the master branch but with the merge strategy, we merge the branch's changes into the master branch and so don't have this problem.
58 lines
2.6 KiB
Go
58 lines
2.6 KiB
Go
package server
|
|
|
|
import "github.com/runatlantis/atlantis/server/logging"
|
|
|
|
// UserConfig holds config values passed in by the user.
|
|
// The mapstructure tags correspond to flags in cmd/server.go and are used when
|
|
// the config is parsed from a YAML file.
|
|
type UserConfig struct {
|
|
AllowForkPRs bool `mapstructure:"allow-fork-prs"`
|
|
AllowRepoConfig bool `mapstructure:"allow-repo-config"`
|
|
AtlantisURL string `mapstructure:"atlantis-url"`
|
|
BitbucketBaseURL string `mapstructure:"bitbucket-base-url"`
|
|
BitbucketToken string `mapstructure:"bitbucket-token"`
|
|
BitbucketUser string `mapstructure:"bitbucket-user"`
|
|
BitbucketWebhookSecret string `mapstructure:"bitbucket-webhook-secret"`
|
|
CheckoutStrategy string `mapstructure:"checkout-strategy"`
|
|
DataDir string `mapstructure:"data-dir"`
|
|
GithubHostname string `mapstructure:"gh-hostname"`
|
|
GithubToken string `mapstructure:"gh-token"`
|
|
GithubUser string `mapstructure:"gh-user"`
|
|
GithubWebhookSecret string `mapstructure:"gh-webhook-secret"`
|
|
GitlabHostname string `mapstructure:"gitlab-hostname"`
|
|
GitlabToken string `mapstructure:"gitlab-token"`
|
|
GitlabUser string `mapstructure:"gitlab-user"`
|
|
GitlabWebhookSecret string `mapstructure:"gitlab-webhook-secret"`
|
|
LogLevel string `mapstructure:"log-level"`
|
|
Port int `mapstructure:"port"`
|
|
RepoWhitelist string `mapstructure:"repo-whitelist"`
|
|
// RequireApproval is whether to require pull request approval before
|
|
// allowing terraform apply's to be run.
|
|
RequireApproval bool `mapstructure:"require-approval"`
|
|
// RequireMergeable is whether to require pull requests to be mergeable before
|
|
// allowing terraform apply's to run.
|
|
RequireMergeable bool `mapstructure:"require-mergeable"`
|
|
SilenceWhitelistErrors bool `mapstructure:"silence-whitelist-errors"`
|
|
SlackToken string `mapstructure:"slack-token"`
|
|
SSLCertFile string `mapstructure:"ssl-cert-file"`
|
|
SSLKeyFile string `mapstructure:"ssl-key-file"`
|
|
TFEToken string `mapstructure:"tfe-token"`
|
|
Webhooks []WebhookConfig `mapstructure:"webhooks"`
|
|
}
|
|
|
|
// ToLogLevel returns the LogLevel object corresponding to the user-passed
|
|
// log level.
|
|
func (u UserConfig) ToLogLevel() logging.LogLevel {
|
|
switch u.LogLevel {
|
|
case "debug":
|
|
return logging.Debug
|
|
case "info":
|
|
return logging.Info
|
|
case "warn":
|
|
return logging.Warn
|
|
case "error":
|
|
return logging.Error
|
|
}
|
|
return logging.Info
|
|
}
|