Skip to content

Instantly share code, notes, and snippets.

@Version2beta
Created May 21, 2014 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Version2beta/6d47df57712ebdb575db to your computer and use it in GitHub Desktop.
Save Version2beta/6d47df57712ebdb575db to your computer and use it in GitHub Desktop.
lua setmetatable issue
local env = os.getenv('DNMENV') or 'dev'
local configs = {
dev = {
db = {
address = "127.0.0.1",
port = 6379,
db = 0,
testdb = 15,
timeout = 1000,
keepalive = { 2000, 1 }
}
},
prod = {},
ci = {}
}
return setmetatable(
configs[env],
{ __call = function(e) return configs[e] end })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment