Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I use environment variables in the envoyproxy config file?

Tags:

envoyproxy

Until now the only solution that I found is use --config-yaml, something like that

envoy -c /etc/service-envoy.yaml \
    --config-yaml "'static_resources': {
    'clusters': [
      {
        'name': 'jaeger',
        'connect_timeout': '1s',
        'type': 'strict_dns',
        'lb_policy': 'round_robin',
        'hosts': [
          {
            'socket_address': {
              'address': '$JAEGER_HOST',
              'port_value': 9411
            }
          }
        ]
      }
    ]
  }"
like image 486
JuanPablo Avatar asked Jan 04 '19 23:01

JuanPablo


People also ask

How do you put environmental variables in web config?

If you want environmental variables to be expanded your application will need to do that itself. A common way of doing this is to use the cmd syntax %variable% and then using Environment. ExpandEnvironmentVariables to expand them.

How do you use environment variables?

On the Advanced tab, click Environment Variables. Click New to create a new environment variable. Click Edit to modify an existing environment variable. After creating or modifying the environment variable, click Apply and then OK to have the change take effect.

How do I import a .env variable?

On the Projects page, select the project that you want to import environment variables to, and click Properties to open the Project Properties window. On the General page, click Environment. In the Environment Variables dialog, click Import from File.


1 Answers

I found the solution in this article, using envsubst

https://blog.markvincze.com/how-to-use-envoy-as-a-load-balancer-in-kubernetes/

cat /tmpl/envoy.yaml.tmpl | envsubst \$ENVOY_LB_ALG,\$SERVICE_NAME > /etc/envoy.yaml
like image 141
JuanPablo Avatar answered Sep 21 '22 22:09

JuanPablo