Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml config: unclear how to specifiy repeating options #863

Open
ovanes opened this issue Mar 5, 2015 · 2 comments
Open

yaml config: unclear how to specifiy repeating options #863

ovanes opened this issue Mar 5, 2015 · 2 comments

Comments

@ovanes
Copy link

ovanes commented Mar 5, 2015

I started to migrate our ini-file configs to yaml files. In our ini file we have multiple environment variables specified, i.e.

[uwsgi]
...

env=DB_HOST=whateverhost
env=SEARCH_SERVER=whateverserver
...

Now I am stuck, with the migration to enviroment variables to yaml. I tried the following possibilities, which do not work:

uwsgi:
   ...
   env:
      - DB_HOST=whateverhost
      - SEARCH_SERVER=whateverserver

or

uwsgi:
   ...
   env:
      DB_HOST: whateverhost
      SEARCH_SERVER: whateverserver

Any suggestions are very welcome :) And may be dock updates...

@unbit
Copy link
Owner

unbit commented Mar 16, 2015

with the embedded parser (the 'dumb' one) you can just pass multiple keys:

uwsgi:
    env: KEY1=VAL1
    env: KEY2=VAL2

while with libyaml-based parsers you need to pass them as sequence:

uwsgi:
    env:
        - KEY1=VAL1
        - KEY2=VAL2

@skaymakca
Copy link

The libyaml-parser can be included in pip based installs by creating a new build configuration.
Make sure the libyaml library and development packages are installed on your system.

Assuming a Unix environment

Create a combined config file for default

# Get the current tarball of uwsgi or extract the build dir from pip
cd BUILD_DIR/buildconf
# Assuming default only inherits from base:
cat default.ini base.ini > PATH/default_wlibyaml.ini

Edit default_wlibyaml.ini:

  1. Make sure there is only one [uwsgi] line
  2. Remove inherit lines
  3. Edit the yaml line to: yaml = libyaml

pip install

# If in virtualenv
source /PATH/TO/VENV/bin/activate

UWSGI_PROFILE=/FULL/PATH/TO/default_wlibyaml.ini pip install uwsgi --no-cache-dir -v

Verify

The verbose flag outputs the build messages and you can see a breakdown of the options in there.

You can also verify the dynamic libraries are linked in the binary:

# Also checking for jansson for JSON support
ldd `which uwsgi` | grep -E "yaml|janss"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants