Skip to content

Commit

Permalink
add flags
Browse files Browse the repository at this point in the history
  • Loading branch information
smonero committed Jan 30, 2024
1 parent 89ea322 commit 5f374c0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ const (
LyftModeFlag = "lyft-mode"
LyftWorkerQueueURLFlag = "lyft-worker-queue-url"

RepoNameForTerraformAdminFlag = "repo-name-for-terraform-admin"
RootNameForTerraformAdminFlag = "root-name-for-terraform-admin"
RevisionForTerraformAdminFlag = "revision-for-terraform-admin"
// NOTE: Must manually set these as defaults in the setDefaults function.
DefaultADBasicUser = ""
DefaultADBasicPassword = ""
Expand Down Expand Up @@ -238,6 +241,18 @@ var stringFlags = map[string]stringFlag{
description: "Provide queue of AWS SQS queue for atlantis work to pull GH events from and process.",
defaultValue: "",
},
RepoNameForTerraformAdminFlag: {
description: "The repo name is necessary when running in terraform admin mode so that we know which repo to clone",
defaultValue: "",
},
RootNameForTerraformAdminFlag: {
description: "The root name is necessary when running in terraform admin mode so that we know which root to run ops on",
defaultValue: "",
},
RevisionForTerraformAdminFlag: {
description: "The revision is necessary when running in terraform admin mode so that we know which revision to run ops on",
defaultValue: "",
},
}

var boolFlags = map[string]boolFlag{
Expand Down
7 changes: 7 additions & 0 deletions server/legacy/user_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
Gateway
Worker
TemporalWorker
TerraformAdmin
)

// UserConfig holds config values passed in by the user.
Expand Down Expand Up @@ -75,6 +76,10 @@ type UserConfig struct {

// Supports adding a default URL to the checkrun UI when details URL is not set
DefaultCheckrunDetailsURL string `mapstructure:"default-checkrun-details-url"`

RepoNameForTerraformAdminFlag string `mapstructure:"repo-name-for-terraform-admin-flag"`
RootNameForTerraformAdminFlag string `mapstructure:"root-name-for-terraform-admin-flag"`
RevisionForTerraformAdminFlag string `mapstructure:"revision-for-terraform-admin-flag"`
}

// ToLogLevel returns the LogLevel object corresponding to the user-passed
Expand Down Expand Up @@ -104,6 +109,8 @@ func (u UserConfig) ToLyftMode() Mode {
return Worker
case "temporalworker":
return TemporalWorker
case "terraformadmin":
return TerraformAdmin
}
return Default
}
4 changes: 4 additions & 0 deletions server/legacy/user_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func TestUserConfig_ToLyftMode(t *testing.T) {
userMode string
expMode server.Mode
}{
{
"terraformadmin",
server.TerraformAdmin,
},
{
"default",
server.Default,
Expand Down

0 comments on commit 5f374c0

Please sign in to comment.