-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
{"baseBranch":"main","baseCommit":"6fb9eefe000403c2a30076356ebf2843419e4ee3","createdAt":"2024-02-15T16:05:42.141988Z","headSha":"5cd5adf35d907231c20e5ba60fbf871e6a89d660","id":"5815a90c-1987-4019-be4a-5f85ae400a30","priority":"200","pullRequestNumber":"622","queuedAt":"2024-02-15T16:05:42.137085Z","status":"STATUS_QUEUED"}
- Loading branch information
Showing
2 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ecsagentparams | ||
|
||
import "github.com/DataDog/test-infra-definitions/common" | ||
|
||
// Params defines the parameters for the ECS Agent installation. | ||
// The Params configuration uses the [Functional options pattern]. | ||
// | ||
// The available options are: | ||
// - [WithAgentServiceEnvVariable] | ||
// | ||
// [Functional options pattern]: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis | ||
|
||
type Params struct { | ||
// AgentServiceEnvironment is a map of environment variables to set in the docker compose agent service's environment. | ||
AgentServiceEnvironment map[string]string | ||
} | ||
|
||
type Option = func(*Params) error | ||
|
||
func NewParams(options ...Option) (*Params, error) { | ||
version := &Params{ | ||
AgentServiceEnvironment: make(map[string]string), | ||
} | ||
return common.ApplyOption(version, options) | ||
} | ||
|
||
// WithAgentServiceEnvVariable set an environment variable in the docker compose agent service's environment. | ||
func WithAgentServiceEnvVariable(key string, value string) func(*Params) error { | ||
return func(p *Params) error { | ||
p.AgentServiceEnvironment[key] = value | ||
return nil | ||
} | ||
} |