# HG changeset patch # User Matthew Wild # Date 1535993130 -3600 # Node ID 2d82a926826f61ef32d480f6a15e5dcc23bff875 # Parent f9a83aca4421b57eb2fbda802f6b7fde6368fa00 configmanager: Allow referencing environment variables in the config as as ENV_ diff -r f9a83aca4421 -r 2d82a926826f core/configmanager.lua --- a/core/configmanager.lua Mon Sep 03 12:26:25 2018 +0100 +++ b/core/configmanager.lua Mon Sep 03 17:45:30 2018 +0100 @@ -7,8 +7,8 @@ -- local _G = _G; -local setmetatable, rawget, rawset, io, error, dofile, type, pairs = - setmetatable, rawget, rawset, io, error, dofile, type, pairs; +local setmetatable, rawget, rawset, io, os, error, dofile, type, pairs = + setmetatable, rawget, rawset, io, os, error, dofile, type, pairs; local format, math_max = string.format, math.max; local envload = require"util.envload".envload; @@ -109,6 +109,9 @@ Component = true, component = true, Include = true, include = true, RunScript = true }, { __index = function (_, k) + if k:match("^ENV_") then + return os.getenv(k:sub(5)); + end return rawget(_G, k); end, __newindex = function (_, k, v)