-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconstants.lua
139 lines (134 loc) · 2.98 KB
/
constants.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
local plugins = {
"jwt",
"acl",
"correlation-id",
"cors",
"oauth2",
"tcp-log",
"udp-log",
"file-log",
"http-log",
"key-auth",
"hmac-auth",
"basic-auth",
"ip-restriction",
"request-transformer",
"response-transformer",
"request-size-limiting",
"rate-limiting",
"response-ratelimiting",
"syslog",
"loggly",
"datadog",
"ldap-auth",
"statsd",
"bot-detection",
"aws-lambda",
"request-termination",
-- external plugins
"azure-functions",
"kubernetes-sidecar-injector",
"zipkin",
"pre-function",
"post-function",
"prometheus",
"proxy-cache",
"ht-log",
--这里添加
"customize",
}
local plugin_map = {}
for i = 1, #plugins do
plugin_map[plugins[i]] = true
end
local deprecated_plugins = {} -- no currently deprecated plugin
local deprecated_plugin_map = {}
for _, plugin in ipairs(deprecated_plugins) do
deprecated_plugin_map[plugin] = true
end
local protocols_with_subsystem = {
http = "http",
https = "http",
tcp = "stream",
tls = "stream"
}
local protocols = {}
for p,_ in pairs(protocols_with_subsystem) do
protocols[#protocols + 1] = p
end
table.sort(protocols)
return {
BUNDLED_PLUGINS = plugin_map,
DEPRECATED_PLUGINS = deprecated_plugin_map,
-- non-standard headers, specific to Kong
HEADERS = {
HOST_OVERRIDE = "X-Host-Override",
PROXY_LATENCY = "X-Kong-Proxy-Latency",
UPSTREAM_LATENCY = "X-Kong-Upstream-Latency",
UPSTREAM_STATUS = "X-Kong-Upstream-Status",
CONSUMER_ID = "X-Consumer-ID",
CONSUMER_CUSTOM_ID = "X-Consumer-Custom-ID",
CONSUMER_USERNAME = "X-Consumer-Username",
CREDENTIAL_USERNAME = "X-Credential-Username",
RATELIMIT_LIMIT = "X-RateLimit-Limit",
RATELIMIT_REMAINING = "X-RateLimit-Remaining",
CONSUMER_GROUPS = "X-Consumer-Groups",
AUTHENTICATED_GROUPS = "X-Authenticated-Groups",
FORWARDED_HOST = "X-Forwarded-Host",
FORWARDED_PREFIX = "X-Forwarded-Prefix",
ANONYMOUS = "X-Anonymous-Consumer",
VIA = "Via",
SERVER = "Server"
},
-- Notice that the order in which they are listed is important:
-- schemas of dependencies need to be loaded first.
CORE_ENTITIES = {
"consumers",
"services",
"routes",
"certificates",
"snis",
"upstreams",
"targets",
"plugins",
"cluster_ca",
"tags",
},
RATELIMIT = {
PERIODS = {
"second",
"minute",
"hour",
"day",
"month",
"year"
}
},
REPORTS = {
ADDRESS = "kong-hf.konghq.com",
SYSLOG_PORT = 61828,
STATS_PORT = 61829
},
DICTS = {
"kong",
"kong_locks",
"kong_db_cache",
"kong_db_cache_miss",
"kong_process_events",
"kong_cluster_events",
"kong_healthchecks",
"kong_rate_limiting_counters",
},
DATABASE = {
POSTGRES = {
MIN = "9.5",
-- also accepts a DEPRECATED key, i.e. DEPRECATED = "9.4"
},
CASSANDRA = {
MIN = "2.2",
-- also accepts a DEPRECATED key
}
},
PROTOCOLS = protocols,
PROTOCOLS_WITH_SUBSYSTEM = protocols_with_subsystem,
}