Divide the MSB source codes into two repos
[msb/apigateway.git] / openresty-ext / src / assembly / resources / openresty / nginx / luaext / conf / msbinit.lua
1 --[[
2
3     Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
4
5     Licensed under the Apache License, Version 2.0 (the "License");
6     you may not use this file except in compliance with the License.
7     You may obtain a copy of the License at
8
9             http://www.apache.org/licenses/LICENSE-2.0
10
11     Unless required by applicable law or agreed to in writing, software
12     distributed under the License is distributed on an "AS IS" BASIS,
13     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14     See the License for the specific language governing permissions and
15     limitations under the License.
16
17 --]]
18
19 local modulename = "msbinit"
20 local _M = {}
21 _M._VERSION = '1.0.0'
22
23 local str_util  =  require('lib.utils.str_util')
24 local mark_empty_as_nil = str_util.mark_empty_as_nil
25
26 _M.systemConf = {
27         ["defaultport"]       = mark_empty_as_nil(os.getenv("HTTP_OVERWRITE_PORT")) or "80",
28         ["defaulthttpsport"]  = mark_empty_as_nil(os.getenv("HTTPS_OVERWRITE_PORT")) or "443",
29         ["defaultprefix"]     = "msb:routing",
30         ["enablefullsearch"]  = true, --whether test against the custom services after common match processing
31         ["enablerefercheck"]  = true, --whether use refer to test against the service names as the last solution
32         ["useconsultemplate"] = true --whether using consul template or not
33 }
34 _M.redisConf = {
35         ["host"]        = "127.0.0.1",
36         ["port"]        = 6379,
37         ["poolsize"]    = 100,
38         ["idletimeout"] = 90000, 
39         ["timeout"]     = 1000,
40         ["dbid"]        = 0
41 }
42 _M.cacheConf = {
43         ["positive_ttl"] = 5, --shcache use,in seconds
44         ["negative_ttl"] = 2,  --shcache use,in seconds
45         ["actualize_ttl"] = 120, --shcache use,in seconds
46         ["lru_ttl"]      = 2  --in seconds
47 }
48 _M.routerConf = {
49         -- cross-domain plugin uses this field in init_by_lua context, ngx.re.gsub is not allowed in this context, using string.gsub instead
50         --["subdomain"]    = ngx.re.gsub(os.getenv("ROUTER_SBUDOMAIN") or "openpalette.zte.com.cn", "\\.", "\\.", "o"),
51         ["subdomain"]    = string.gsub(mark_empty_as_nil(os.getenv("ROUTER_SUBDOMAIN")) or "openpalette.zte.com.cn", "%.", "\\."),
52         ["defaultprefix"]= "msb:host"
53 }
54 _M.server = {
55         ["fail_timeout"]  = 10,
56         ["max_fails"]     = 1
57 }
58 return _M