Documentation
¶
Overview ¶
Package config handles loading configuration data, warning on missing data, and setting sane defaults.
Configuration Sources ¶
Configuration data is loaded from two sources currently: the environment and a json config file.
Environment Variables:
The environment variables from which configuration values are loaded are documented in the README file which can be found at https://github.com/aws/amazon-ecs-agent#environment-variables.
Config file:
The config file will be loaded from the path stored in the environment key ECS_AGENT_CONFIG_FILE_PATH. It must be a JSON file of the format described by the "Config" struct below.
Index ¶
Constants ¶
const ( // http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=docker DOCKER_RESERVED_PORT = 2375 DOCKER_RESERVED_SSL_PORT = 2376 SSH_PORT = 22 AGENT_INTROSPECTION_PORT = 51678 DEFAULT_CLUSTER_NAME = "default" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DEPRECATED
// ClusterArn is the Name or full ARN of a Cluster to register into. It has
// been deprecated (and will eventually be removed) in favor of Cluster
ClusterArn string `deprecated:"Please use Cluster instead"`
// Cluster can either be the Name or full ARN of a Cluster. This is the
// cluster the agent should register this ContainerInstance into. If this
// value is not set, it will default to "default"
Cluster string
// APIEndpoint is the endpoint, such as "ecs.us-east-1.amazonaws.com", to
// make calls against. If this value is not set, it will default to the
// endpoint for your current AWSRegion
APIEndpoint string
// DockerEndpoint is the address the agent will attempt to connect to the
// Docker daemon at. This should have the same value as "DOCKER_HOST"
// normally would to interact with the daemon. It defaults to
// unix:///var/run/docker.sock
DockerEndpoint string
// AWSRegion is the region to run in (such as "us-east-1"). This value is
// used to determine the correct APIEndpoint.
AWSRegion string `missing:"warn"`
// ReservedPorts is an array of ports which should be registerd as
// unavailable. If not set, they default to [22,2375,2376,51678].
ReservedPorts []uint16
// DataDir is the directory data is saved to in order to preserve state
// across agent restarts. It is only used if "Checkpoint" is true as well.
DataDir string
// Checkpoint configures whether data should be periodically to a checkpoint
// file, in DataDir, such that on instance or agent restarts it will resume
// as the same ContainerInstance. It defaults to false.
Checkpoint bool
// EngineAuthType configures what type of data is in EngineAuthData.
// Supported types, right now, can be found in the dockerauth package: https://godoc.org/github.com/aws/amazon-ecs-agent/agent/engine/dockerauth
EngineAuthType string
// EngineAuthData contains authentication data. Please see the documentation
// for EngineAuthType for more information.
EngineAuthData json.RawMessage
// UpdatesEnabled specifies whether updates should be applied to this agent.
// Default true
UpdatesEnabled bool
// UpdateDownloadDir specifies where new agent versions should be placed
// within the container in order for the external updating process to
// correctly handle them.
UpdateDownloadDir string
}
func DefaultConfig ¶
func DefaultConfig() Config
func EC2MetadataConfig ¶
func EC2MetadataConfig() Config
func EnvironmentConfig ¶
func EnvironmentConfig() Config
EnvironmentConfig reads the given configs from the environment and attempts to convert them to the given type
func FileConfig ¶
func FileConfig() Config
func (*Config) CheckMissingAndDepreciated ¶
func (cfg *Config) CheckMissingAndDepreciated()
CheckMissing checks all zero-valued fields for tags of the form missing:STRING and acts based on that string. Current options are: fatal, warn. Fatal will result in a fatal error, warn will result in a warning that the field is missing being logged
type ConfigReader ¶
type ConfigReader interface {
ReadConfig() *Config
}