use perl_set to expose env variables

This commit is contained in:
Karol Wypchlo 2021-06-16 13:16:41 +02:00
parent cb85ed355a
commit e463199022
1 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,11 @@ http {
#gzip on; #gzip on;
# expose env variables as regular variables (env variables are not easily accessible in nginx)
perl_set $SKYNET_PORTAL_API 'sub { return $ENV{"SKYNET_PORTAL_API"}; }';
perl_set $SKYNET_SERVER_API 'sub { return $ENV{"SKYNET_SERVER_API"}; }';
perl_set $ACCOUNTS_ENABLED 'sub { return $ENV{"ACCOUNTS_ENABLED"}; }';
# include skynet-portal-api header on every request # include skynet-portal-api header on every request
header_filter_by_lua 'ngx.header["Skynet-Portal-Api"] = os.getenv("SKYNET_PORTAL_API")'; header_filter_by_lua 'ngx.header["Skynet-Portal-Api"] = os.getenv("SKYNET_PORTAL_API")';