Skip to content

Commit

Permalink
fixed get_config
Browse files Browse the repository at this point in the history
  • Loading branch information
ldmiao committed Dec 3, 2012
1 parent f3174fb commit fc09c47
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions luasrc/mch/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,20 @@ function get_config(key, default)
local ret = ngx.var[key]
if ret then return ret end
local app_conf=mchvars.get(ngx.ctx.MOOCHINE_APP_NAME,"APP_CONFIG")
return app_conf[key] or default

local v = app_conf[key]
if v==nil then v = default end
return v
end

-- sub app
if not subname then return default end
local subapps=mchvars.get(ngx.ctx.MOOCHINE_APP_NAME,"APP_CONFIG").subapps or {}
local subconfig=subapps[subname].config or {}
return subconfig[key] or default


local v = subconfig[key]
if v==nil then v = default end
return v
end

function _strify(o, tab, act, logged)
Expand Down

0 comments on commit fc09c47

Please sign in to comment.