Skip to content

Commit

Permalink
Merge e6b37ce into dd5c1a1
Browse files Browse the repository at this point in the history
  • Loading branch information
moorefu committed Jul 30, 2020
2 parents dd5c1a1 + e6b37ce commit 0b22374
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .travis/apisix_cli_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,20 @@ if [ ! $? -eq 0 ]; then
fi

echo "passed: worker_shutdown_timeout in nginx.conf is ok"

# check custom environment variable in nginx.conf

sed -i 's/#environment:/environment:\n TNS_ADMIN:\n DATACENTER_ID: 1/' conf/config.yaml

make init

set +ex
sed ":a;N;s/\n//g;ta" conf/nginx.conf |grep -E "env TNS_ADMIN;env DATACENTER_ID=1;" > /dev/null
if [ ! $? -eq 0 ]; then
echo "failed: custom environment variable in nginx.conf is not expect"
exit 1
fi

set -ex

echo "passed: custom environment variable in nginx.conf is ok"
6 changes: 6 additions & 0 deletions bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ worker_rlimit_core {* worker_rlimit_core *};
worker_shutdown_timeout {* worker_shutdown_timeout *};
env APISIX_PROFILE;
# for custom environment variable
{% if http.environment then %}
{% for env_key, env_value in pairs(http.environment) do %}
env {*env_key*}{% if tostring(env_value)~="yaml.null" then %}={*env_value*}{% end %};
{% end %}
{% end %}
{% if stream_proxy then %}
stream {
Expand Down
3 changes: 3 additions & 0 deletions conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ nginx_config: # config for render the template to genarate n
- 'unix:'
#lua_shared_dicts: # add custom shared cache to nginx.conf
# ipc_shared_dict: 100m # custom shared cache, format: `cache-key: cache-size`
#environment: # add custom environment variable to nginx.conf
# TNS_ADMIN: # environment variable format: `env-key: [env-value]`
# DATACENTER_ID: 1

etcd:
host: # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
Expand Down

0 comments on commit 0b22374

Please sign in to comment.