Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
smonero committed Feb 29, 2024
1 parent 4283ab0 commit 3c4d668
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ var stringFlags = map[string]stringFlag{
"default: Runs atlantis with default event handler that processes events within same.\n" +
"gateway: Runs atlantis with gateway event handler that publishes events through sns.\n" +
"worker: Runs atlantis with a sqs handler that polls for events in the queue to process.\n" +
"hybrid: Runs atlantis with both a gateway event handler and sqs handler to perform both gateway and worker behaviors.",
"hybrid: Runs atlantis with both a gateway event handler and sqs handler to perform both gateway and worker behaviors.\n" +
"terraformadmin: Runs atlantis in a mode that allows for running terraform commands on behalf of other users.",
defaultValue: "",
},
LyftWorkerQueueURLFlag: {
Expand Down Expand Up @@ -344,6 +345,7 @@ func NewServerCmd(v *viper.Viper, version string) *ServerCmd {
GatewayCreator: &GatewayCreator{},
WorkerCreator: &WorkerCreator{},
TemporalWorkerCreator: &TemporalWorker{},
TerraformAdminCreator: &TerraformAdmin{},

Check failure on line 348 in cmd/server.go

View workflow job for this annotation

GitHub Actions / runner / gotest

undefined: TerraformAdmin

Check failure on line 348 in cmd/server.go

View workflow job for this annotation

GitHub Actions / runner / gotest

undefined: TerraformAdmin

Check failure on line 348 in cmd/server.go

View workflow job for this annotation

GitHub Actions / runner / golangci-lint

undefined: TerraformAdmin

Check failure on line 348 in cmd/server.go

View workflow job for this annotation

GitHub Actions / runner / golangci-lint

undefined: TerraformAdmin

Check failure on line 348 in cmd/server.go

View workflow job for this annotation

GitHub Actions / runner / golangci-lint

undefined: TerraformAdmin
},
Viper: v,
AtlantisVersion: version,
Expand Down Expand Up @@ -374,6 +376,7 @@ type ServerCreatorProxy struct {
GatewayCreator ServerCreator
WorkerCreator ServerCreator
TemporalWorkerCreator ServerCreator
TerraformAdminCreator ServerCreator
}

func (d *ServerCreatorProxy) NewServer(userConfig server.UserConfig, config server.Config) (ServerStarter, error) {
Expand All @@ -389,6 +392,10 @@ func (d *ServerCreatorProxy) NewServer(userConfig server.UserConfig, config serv
return d.TemporalWorkerCreator.NewServer(userConfig, config)
}

if userConfig.ToLyftMode() == server.TerraformAdmin {
return d.TerraformAdminCreator.NewServer(userConfig, config)
}

return d.WorkerCreator.NewServer(userConfig, config)
}

Expand Down
3 changes: 3 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 @@ -104,6 +105,8 @@ func (u UserConfig) ToLyftMode() Mode {
return Worker
case "temporalworker":
return TemporalWorker
case "terraformadmin":
return TerraformAdmin
}
return Default
}
8 changes: 8 additions & 0 deletions server/legacy/user_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ func TestUserConfig_ToLyftMode(t *testing.T) {
"",
server.Default,
},
{
"terraformadmin",
server.TerraformAdmin,
},
{
"temporalworker",
server.TemporalWorker,
},
}

for _, c := range cases {
Expand Down

0 comments on commit 3c4d668

Please sign in to comment.