6

I am using .ini files (as per uWSGI docs). It's good practise to use environment variables, but I wasn't able to get the $+environment name syntax working.

Is there a special syntax I can use to access them?

stackoverflowuser95
  • 1,992
  • 3
  • 20
  • 30

2 Answers2

17

The syntax is $(var), for example:

chdir = $(HOME)/foobar

See also How uWSGI parses config files.

Roald Nefs
  • 1,302
  • 10
  • 29
roberto
  • 12,723
  • 44
  • 30
  • 8
    Is there a way to have a default (in case the env var is not set)? – David S May 21 '14 at 20:21
  • 3
    @roberto, also wondering about what David is asking. For example if I wanted to set the value for `threads` from an environment variable, but fall back to the default (1 thread per process) if the environment variable is not defined...? – B Robster Jan 13 '15 at 06:07
2

contents of evironment variables and external text files can be included using the $(ENV_VAR) and @(file_name) syntax. See also How uWSGI parses config files.

pigletfly
  • 1,051
  • 1
  • 16
  • 32