Add loader for environment variables

This commit is contained in:
Talia 2022-09-19 13:15:26 +02:00
parent 8294716cfa
commit 4775ec851d
2 changed files with 9 additions and 0 deletions

View file

@ -16,6 +16,7 @@ build = {
glass = "glass.lua",
["glass.cosmo"] = "glass/cosmo.lua",
["glass.discount"] = "glass/discount.lua",
["glass.environment"] = "glass/environment.lua",
["glass.json"] = "glass/json.lua",
["glass.lua"] = "glass/lua.lua",
["glass.moonhtml"] = "glass/moonhtml.lua",

8
glass/environment.lua Normal file
View file

@ -0,0 +1,8 @@
--- Loader for environment variables
-- @module glass.environment
--- Loads values from environment variables
-- @treturn string The value of the environment variable
return function(name)
return os.getenv(name:match("[^/].+$"))
end