Supervisord using environment variables in command
Asked Answered
S

2

6

My supervisor configuration file

environment=USER=%(ENV_FLOWER_USER_NAME),PASS=%(ENV_FLOWER_PASSWORD)
command=/usr/local/opt/python/bin/flower --basic_auth=%(ENV_USER}:%(ENV_PASS)

When I start supervisord, I receive the following error

Restarting supervisor: Error: Format string 'USER=%(ENV_FLOWER_USER_NAME),PASS=%(ENV_FLOWER_PASSWORD)' for 'environment' is badly formatted

Any ideas?

Spadefish answered 9/2, 2015 at 13:44 Comment(0)
W
5

Looks like you are missing the leading s in formatting environment variable name. Here is sample config file.

You should use

environment=USER=%(ENV_FLOWER_USER_NAME)s,PASS=%(ENV_FLOWER_PASSWORD)s
command=/usr/local/opt/python/bin/flower --basic_auth=%(ENV_USER)s:%(ENV_PASS)s

For readability

environment=
    USER=%(ENV_FLOWER_USER_NAME)s,
    PASS=%(ENV_FLOWER_PASSWORD)s

command=/usr/local/opt/python/bin/flower 
            --basic_auth=%(ENV_USER)s:%(ENV_PASS)s
Wein answered 25/3, 2015 at 4:38 Comment(0)
E
0

Use a variable if this form is prefixed with %(ENV_NAME)s to the name.

docker-compose.yml

environment:
  ENVIRONMENT: production
  PORT: 8011 # port uwsgi

supervisord.conf

[program:uwsgi]
command=uwsgi --ini uwsgi.ini --http :%(ENV_PORT)s

saludos :)

Emmaline answered 23/11, 2020 at 19:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.