It looks like you're trying to set environment variables in the first
line and then access them via the new name in the second line. I
don't think it works that way. The `environment` line sets the
environment for the child process, not for supervisord, but the `ENV_`
prefix gives you access only to supervisord's environment. Possibly
what you want is simply the following:
command=/usr/local/opt/python/bin/flower
--basic_auth=%(ENV_FLOWER_USER_NAME)s:%(ENV_FLOWER_PASSWORD)s
Alternatively you could execute the python process via a shell script.
This is a common approach to setting up the environment. You must
however make sure that you exec the correct process at the end of the
script, or supervisor will lose control of the process:
#!/bin/bash
# startflower.sh
USER=$ENV_FLOWER_USER_NAME
PASS=$ENV_FLOWER_PASSWORD
exec /usr/local/opt/python/bin/flower --basic_auth=$USER:$PASS
And then:
# flower.conf
command=/path/to/startflower.sh
On Mon, Feb 09, 2015 at 10:28:54PM +0200, Aryeh Leib Taurog wrote:
> You need an 's' after the closing parenthesis:
>
> 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
>
> See the python string formatting documentation for more on this:
> <https://docs.python.org/release/2.7/library/stdtypes.html#string-formatting-operations>
>
> On Mon, Feb 09, 2015 at 12:20:43PM -0800, Josh Joy wrote:
> > Hi,
> >
> > I'm trying to use environment variables in my command, though unable to
> > run.
> >
> > 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?
> >
> > Thanks,
> > Josh
>
> > _______________________________________________
> > Supervisor-users mailing list
> > [email protected]
> > https://lists.supervisord.org/mailman/listinfo/supervisor-users
>
> _______________________________________________
> Supervisor-users mailing list
> [email protected]
> https://lists.supervisord.org/mailman/listinfo/supervisor-users
_______________________________________________
Supervisor-users mailing list
[email protected]
https://lists.supervisord.org/mailman/listinfo/supervisor-users