in lib/consul-mesh-extension.ts [446:480]
private get buildConsulClientCommand(): string[] {
let TLSCommand = "";
let gossipCommand = "";
if (this.tls) {
TLSCommand = ` \
-hcl 'ca_file = "/tmp/consul-agent-ca-cert.pem"' \
-hcl 'auto_encrypt = {tls = true}' \
-hcl "auto_encrypt = {ip_san = [ \\"$ECS_IPV4\\" ]}" \
-hcl 'verify_outgoing = true'`;
}
if (this.gossipEncryptKey) {
gossipCommand = ` \
-encrypt "${this.gossipEncryptKey?.secretValue}"`;
}
return [`cp /bin/consul /bin/consul-inject/consul &&
ECS_IPV4=$(curl -s $ECS_CONTAINER_METADATA_URI | jq -r '.Networks[0].IPv4Addresses[0]') && if [ ${this.tls} == true ]; then \
echo "${this.consulCACert?.secretValue}" > /tmp/consul-agent-ca-cert.pem;
fi &&
exec consul agent \
-advertise $ECS_IPV4 \
-data-dir /consul/data \
-client 0.0.0.0 \
-datacenter "${this.consulDatacenter}" \
-hcl 'addresses = { dns = "127.0.0.1" }' \
-hcl 'addresses = { grpc = "127.0.0.1" }' \
-hcl 'addresses = { http = "127.0.0.1" }' \
-retry-join "${this.retryJoin.getRetryjoinString()}" \
-hcl 'telemetry { disable_compat_1.9 = true }' \
-hcl 'leave_on_terminate = true' \
-hcl 'ports { grpc = 8502 }' \
-hcl 'advertise_reconnect_timeout = "15m"' \
-hcl 'enable_central_service_config = true'` + TLSCommand + gossipCommand]
}