mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(logger/loki): Support for tenants when running Loki in multi-tenant mode (#477)
This commit is contained in:
@@ -131,6 +131,7 @@ if service == 'loki' then
|
|||||||
local lokiUser = GetConvar('loki:user', '')
|
local lokiUser = GetConvar('loki:user', '')
|
||||||
local lokiPassword = GetConvar('loki:password', GetConvar('loki:key', ''))
|
local lokiPassword = GetConvar('loki:password', GetConvar('loki:key', ''))
|
||||||
local lokiEndpoint = GetConvar('loki:endpoint', '')
|
local lokiEndpoint = GetConvar('loki:endpoint', '')
|
||||||
|
local lokiTenant = GetConvar('loki:tenant', '')
|
||||||
local startingPattern = '^http[s]?://'
|
local startingPattern = '^http[s]?://'
|
||||||
local headers = {
|
local headers = {
|
||||||
['Content-Type'] = 'application/json'
|
['Content-Type'] = 'application/json'
|
||||||
@@ -140,6 +141,10 @@ if service == 'loki' then
|
|||||||
headers['Authorization'] = getAuthorizationHeader(lokiUser, lokiPassword)
|
headers['Authorization'] = getAuthorizationHeader(lokiUser, lokiPassword)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if lokiTenant ~= '' then
|
||||||
|
headers['X-Scope-OrgID'] = lokiTenant
|
||||||
|
end
|
||||||
|
|
||||||
if not lokiEndpoint:find(startingPattern) then
|
if not lokiEndpoint:find(startingPattern) then
|
||||||
lokiEndpoint = 'https://' .. lokiEndpoint
|
lokiEndpoint = 'https://' .. lokiEndpoint
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user