Use the environment variable directly
This commit is contained in:
1 parent
0919b03143
commit
f7d3367a9f
1 file changed
+10
-9
@@ -11,18 +11,19 @@ server {
|
|||||||
# Server domain name
|
# Server domain name
|
||||||
server_name _;
|
server_name _;
|
||||||
|
|
||||||
set_by_lua_block $pot_url_scheme {
|
set_by_lua_block $pot_url {
|
||||||
local haystack = os.getenv('YT_POT_BGUTIL_BASE_URL') or ''
|
local default = 'http://token_server'
|
||||||
local needle = 'https://'
|
local url = os.getenv('YT_POT_BGUTIL_BASE_URL')
|
||||||
local scheme = 'http'
|
if not url then
|
||||||
if haystack:sub(1, #needle) == needle then
|
return default
|
||||||
scheme = 'https'
|
|
||||||
end
|
end
|
||||||
return scheme
|
if #url and url:find('://') then
|
||||||
|
return url
|
||||||
|
end
|
||||||
|
return default
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass $pot_url_scheme://token_server;
|
proxy_pass $pot_url;
|
||||||
proxy_redirect default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user