Use the environment variable directly

This commit is contained in:
tcely authored and GitHub committed 2025-05-16 23:37:23 -04:00
1 parent 0919b03143
commit f7d3367a9f
1 file changed
+10 -9
+10 -9
View File
@@ -11,18 +11,19 @@ server {
# Server domain name
server_name _;
set_by_lua_block $pot_url_scheme {
local haystack = os.getenv('YT_POT_BGUTIL_BASE_URL') or ''
local needle = 'https://'
local scheme = 'http'
if haystack:sub(1, #needle) == needle then
scheme = 'https'
set_by_lua_block $pot_url {
local default = 'http://token_server'
local url = os.getenv('YT_POT_BGUTIL_BASE_URL')
if not url then
return default
end
return scheme
if #url and url:find('://') then
return url
end
return default
}
location / {
proxy_pass $pot_url_scheme://token_server;
proxy_redirect default;
proxy_pass $pot_url;
}
}