aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-09-03 17:45:30 +0100
committerMatthew Wild <mwild1@gmail.com>2018-09-03 17:45:30 +0100
commit55a6e42c6485ee2fdbdc6173c05d30b5ad8002ae (patch)
tree8a7466b0cdec5d6cf108328144c9b37d790cacc7
parentb16c2dac44b644a26b8a06b606ebfb1c4d86fb9a (diff)
downloadprosody-55a6e42c6485ee2fdbdc6173c05d30b5ad8002ae.tar.gz
prosody-55a6e42c6485ee2fdbdc6173c05d30b5ad8002ae.zip
configmanager: Allow referencing environment variables in the config as as ENV_<name>
-rw-r--r--core/configmanager.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index d9482b81..1e67da9b 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -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 @@ do
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)