-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathconfig.go
More file actions
1574 lines (1278 loc) · 73.2 KB
/
Copy pathconfig.go
File metadata and controls
1574 lines (1278 loc) · 73.2 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package config
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
"github.com/kelseyhightower/envconfig"
"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/internal/otel"
logger "github.com/TykTechnologies/tyk/log"
"github.com/TykTechnologies/tyk/regexp"
)
type IPsHandleStrategy string
const GracefulShutdownDefaultDuration = 30
var (
log = logger.Get()
Default = Config{
ListenPort: 8080,
Secret: "352d20ee67be67f6340b4c0605b044b7",
TemplatePath: "templates",
MiddlewarePath: "middleware",
AppPath: "apps/",
Storage: StorageOptionsConf{
Type: "redis",
Host: "localhost",
MaxIdle: 100,
Port: 6379,
},
AnalyticsConfig: AnalyticsConfigConfig{
IgnoredIPs: make([]string, 0),
},
DnsCache: DnsCacheConfig{
Enabled: false,
TTL: dnsCacheDefaultTtl,
CheckInterval: dnsCacheDefaultCheckInterval,
MultipleIPsHandleStrategy: NoCacheStrategy,
},
HealthCheckEndpointName: "hello",
ReadinessCheckEndpointName: "ready",
CoProcessOptions: CoProcessConfig{
EnableCoProcess: false,
},
LivenessCheck: LivenessCheckConfig{
CheckDuration: time.Second * 10,
},
GracefulShutdownTimeoutDuration: GracefulShutdownDefaultDuration,
Streaming: StreamingConfig{
Enabled: false,
AllowUnsafe: []string{},
},
PIDFileLocation: "/var/run/tyk/tyk-gateway.pid",
Security: SecurityConfig{
CertificateExpiryMonitor: CertificateExpiryMonitorConfig{
WarningThresholdDays: DefaultWarningThresholdDays,
CheckCooldownSeconds: DefaultCheckCooldownSeconds,
EventCooldownSeconds: DefaultEventCooldownSeconds,
},
},
}
)
// Certificate monitor constants
const (
// DefaultWarningThresholdDays is the number of days before certificate expiration that the Gateway will start sending CertificateExpiringSoon notifications
DefaultWarningThresholdDays = 30
// DefaultCheckCooldownSeconds is the minimum time in seconds that the Gateway will leave between checking for the expiry of a certificate when it is used in an API request
DefaultCheckCooldownSeconds = 3600 // 1 hour
// DefaultEventCooldownSeconds is the minimum time in seconds that the Gateway will leave between firing an event for an expiring or expired certificate; this default will be applied as a floor value to protect the system from misconfiguration, but can be overridden by setting a longer cooldown in the CertificateExpiryMonitorConfig
DefaultEventCooldownSeconds = 86400 // 24 hours
)
const (
envPrefix = "TYK_GW"
dnsCacheDefaultTtl = 3600
dnsCacheDefaultCheckInterval = 60
PickFirstStrategy IPsHandleStrategy = "pick_first"
RandomStrategy IPsHandleStrategy = "random"
NoCacheStrategy IPsHandleStrategy = "no_cache"
DefaultDashPolicySource = "service"
DefaultDashPolicyRecordName = "tyk_policies"
DefaultOTelResourceName = "tyk-gateway"
)
type PolicySource string
const (
PolicySourceService PolicySource = "service"
PolicySourceRpc PolicySource = "rpc"
PolicySourceFile PolicySource = "file"
)
type PoliciesConfig struct {
// Set this value to `file` to look in the file system for a definition file. Set to `service` to use the Dashboard service.
PolicySource PolicySource `json:"policy_source"`
// This option is required if `policies.policy_source` is set to `service`.
// Set this to the URL of your Tyk Dashboard installation. The URL needs to be formatted as: http://dashboard_host:port.
PolicyConnectionString string `json:"policy_connection_string"`
// This option only applies in OSS deployment when the `policies.policy_source` is either set
// to `file` or an empty string. If `policies.policy_path` is not set, then Tyk will load policies
// from the JSON file specified by `policies.policy_record_name`.
PolicyRecordName string `json:"policy_record_name"`
// In a Pro installation, Tyk will load Policy IDs and use the internal object-ID as the ID of the policy.
// This is not portable in cases where the data needs to be moved from installation to installation.
//
// If you set this value to `true`, then the id parameter in a stored policy (or imported policy using the Dashboard API), will be used instead of the internal ID.
//
// This option should only be used when moving an installation to a new database.
//
// Deprecated. Is not used in codebase.
AllowExplicitPolicyID bool `json:"allow_explicit_policy_id"`
// This option only applies in OSS deployment when the `policies.policy_source` is either set
// to `file` or an empty string. If `policies.policy_path` is set, then Tyk will load policies
// from all the JSON files under the directory specified by the `policies.policy_path` option.
// In this configuration, Tyk Gateway will allow policy management through the Gateway API.
PolicyPath string `json:"policy_path"`
}
type DBAppConfOptionsConfig struct {
// Set the URL to your Dashboard instance (or a load balanced instance). The URL needs to be formatted as: `http://dashboard_host:port`
ConnectionString string `json:"connection_string"`
// Set a timeout value, in seconds, for your Dashboard connection. Default value is 30.
ConnectionTimeout int `json:"connection_timeout"`
// Set to `true` to enable filtering (sharding) of APIs.
NodeIsSegmented bool `json:"node_is_segmented"`
// The tags to use when filtering (sharding) Tyk Gateway nodes. Tags are processed as `OR` operations.
// If you include a non-filter tag (e.g. an identifier such as `node-id-1`, this will become available to your Dashboard analytics).
Tags []string `json:"tags"`
}
type StorageOptionsConf struct {
// This should be set to `redis` (lowercase)
Type string `json:"type"`
// The Redis host, by default this is set to `localhost`, but for production this should be set to a cluster.
Host string `json:"host"`
// The Redis instance port.
Port int `json:"port"`
Hosts map[string]string `json:"hosts"` // Deprecated: Addrs instead.
// If you have multi-node setup, you should use this field instead. For example: ["host1:port1", "host2:port2"].
Addrs []string `json:"addrs"`
// Redis sentinel master name
MasterName string `json:"master_name"`
// Redis sentinel password
SentinelPassword string `json:"sentinel_password"`
// Redis user name
Username string `json:"username"`
// If your Redis instance has a password set for access, you can set it here.
Password string `json:"password"`
// Redis database
Database int `json:"database"`
// Set the number of maximum idle connections in the Redis connection pool, which defaults to 100. Set to a higher value if you are expecting more traffic.
MaxIdle int `json:"optimisation_max_idle"`
// Set the number of maximum connections in the Redis connection pool, which defaults to 500. Set to a higher value if you are expecting more traffic.
MaxActive int `json:"optimisation_max_active"`
// Set a custom timeout for Redis network operations. Default value 5 seconds.
Timeout int `json:"timeout"`
// Enable Redis Cluster support
EnableCluster bool `json:"enable_cluster"`
// Enable SSL/TLS connection between your Tyk Gateway & Redis.
UseSSL bool `json:"use_ssl"`
// Disable TLS verification
SSLInsecureSkipVerify bool `json:"ssl_insecure_skip_verify"`
// Path to the CA file.
CAFile string `json:"ca_file"`
// Path to the cert file.
CertFile string `json:"cert_file"`
// Path to the key file.
KeyFile string `json:"key_file"`
// Maximum TLS version that is supported.
// Options: ["1.0", "1.1", "1.2", "1.3"].
// Defaults to "1.3".
TLSMaxVersion string `json:"tls_max_version"`
// Minimum TLS version that is supported.
// Options: ["1.0", "1.1", "1.2", "1.3"].
// Defaults to "1.2".
TLSMinVersion string `json:"tls_min_version"`
// Enables Zstd compression of API definitions stored in Redis backups.
// When enabled, API definitions are compressed before encryption, reducing Redis storage.
// The Gateway can read both compressed and uncompressed formats for backward compatibility.
// Note: Decompression has a 100MB memory limit.
// Defaults to false.
CompressAPIDefinitions bool `json:"compress_api_definitions"`
}
type NormalisedURLConfig struct {
// Set this to `true` to enable normalisation.
Enabled bool `json:"enabled"`
// Set this to true to have Tyk automatically clean up UUIDs. It will match the following styles:
//
// * `/15873a748894492162c402d67e92283b/search`
// * `/CA761232-ED42-11CE-BACD-00AA0057B223/search`
// * `/ca761232-ed42-11ce-BAcd-00aa0057b223/search`
// * `/ca761232-ed42-11ce-BAcd-00aa0057b223/search`
// Each UUID will be replaced with a placeholder {uuid}
NormaliseUUIDs bool `json:"normalise_uuids"`
// Set this to true to have Tyk automatically clean up ULIDs. It will match the following style:
//
// * `/posts/01G9HHNKWGBHCQX7VG3JKSZ055/comments`
// * `/posts/01g9hhnkwgbhcqx7vg3jksz055/comments`
// * `/posts/01g9HHNKwgbhcqx7vg3JKSZ055/comments`
// Each ULID will be replaced with a placeholder {ulid}
NormaliseULIDs bool `json:"normalise_ulids"`
// Set this to true to have Tyk automatically match for numeric IDs, it will match with a preceding slash so as not to capture actual numbers:
NormaliseNumbers bool `json:"normalise_numbers"`
// This is a list of custom patterns you can add. These must be valid regex strings. Tyk will replace these values with a `{var}` placeholder.
Custom []string `json:"custom_patterns"`
CompiledPatternSet NormaliseURLPatterns `json:"-"` // see analytics.go
}
type NormaliseURLPatterns struct {
UUIDs *regexp.Regexp
ULIDs *regexp.Regexp
IDs *regexp.Regexp
Custom []*regexp.Regexp
}
type AnalyticsConfigConfig struct {
// Set empty for a Self-Managed installation or `rpc` for multi-cloud.
Type string `json:"type"`
// Adding IP addresses to this list will cause Tyk to ignore these IPs in the analytics data. These IP addresses will not produce an analytics log record.
// This is useful for health checks and other samplers that might skew usage data.
// The IP addresses must be provided as a JSON array, with the values being single IPs. CIDR values are not supported.
IgnoredIPs []string `json:"ignored_ips"`
// Set this value to `true` to have Tyk store the inbound request and outbound response data in HTTP Wire format as part of the Analytics data.
// Please note, this will greatly increase your analytics DB size and can cause performance degradation on analytics processing by the Dashboard.
// This setting can be overridden with an organization flag, enabed at an API level, or on individual Key level.
EnableDetailedRecording bool `json:"enable_detailed_recording"`
// Tyk can store GeoIP information based on MaxMind DB’s to enable GeoIP tracking on inbound request analytics. Set this value to `true` and assign a DB using the `geo_ip_db_path` setting.
EnableGeoIP bool `json:"enable_geo_ip"`
// Path to a MaxMind GeoIP database
// The analytics GeoIP DB can be replaced on disk. It will cleanly auto-reload every hour.
GeoIPDBLocation string `json:"geo_ip_db_path"`
// This section describes methods that enable you to normalise inbound URLs in your analytics to have more meaningful per-path data.
NormaliseUrls NormalisedURLConfig `json:"normalise_urls"`
// Number of workers used to process analytics. Defaults to number of CPU cores.
PoolSize int `json:"pool_size"`
// Number of records in analytics queue, per worker. Default: 1000.
RecordsBufferSize uint64 `json:"records_buffer_size"`
// You can set a time (in seconds) to configure how long analytics are kept if they are not processed. The default is 60 seconds.
// This is used to prevent the potential infinite growth of Redis analytics storage.
StorageExpirationTime int `json:"storage_expiration_time"`
// Set this to `true` to have Tyk automatically divide the analytics records in multiple analytics keys.
// This is especially useful when `storage.enable_cluster` is set to `true` since it will distribute the analytic keys across all the cluster nodes.
EnableMultipleAnalyticsKeys bool `json:"enable_multiple_analytics_keys"`
// You can set the interval length on how often the tyk Gateway will purge analytics data. This value is in seconds and defaults to 10 seconds.
PurgeInterval float32 `json:"purge_interval"`
ignoredIPsCompiled map[string]bool
// Determines the serialization engine for analytics. Available options: msgpack, and protobuf. By default, msgpack.
SerializerType string `json:"serializer_type"`
}
// AccessLogsConfig defines the type of transactions logs printed to stdout.
type AccessLogsConfig struct {
// Enabled controls the generation of access logs by the Gateway. Default: false.
Enabled bool `json:"enabled"`
// Template configures which fields to include in the access log.
// If no template is configured, all available fields will be logged.
//
// Example: ["client_ip", "path"].
//
// Template Options:
//
// - `api_key` will include they obfuscated or hashed key.
// - `client_ip` will include the ip of the request.
// - `host` will include the host of the request.
// - `method` will include the request method.
// - `path` will include the path of the request.
// - `protocol` will include the protocol of the request.
// - `remote_addr` will include the remote address of the request.
// - `upstream_addr` will include the upstream address (scheme, host and path)
// - `upstream_latency` will include the upstream latency of the request.
// - `latency_total` will include the total latency of the request.
// - `user_agent` will include the user agent of the request.
// - `status` will include the response status code.
Template []string `json:"template"`
}
type HealthCheckConfig struct {
// Setting this value to `true` will enable the health-check endpoint on /Tyk/health.
EnableHealthChecks bool `json:"enable_health_checks"`
// This setting defaults to 60 seconds. This is the time window that Tyk uses to sample health-check data.
// You can set a higher value for more accurate data (a larger sample period), or a lower value for less accurate data.
// The reason this value is configurable is because sample data takes up space in your Redis DB to store the data to calculate samples. On high-availability systems this may not be desirable and smaller values may be preferred.
HealthCheckValueTimeout int64 `json:"health_check_value_timeouts"`
}
type LivenessCheckConfig struct {
// Frequencies of performing interval healthchecks for Redis, Dashboard, and RPC layer.
// Expressed in Nanoseconds. For example: 1000000000 -> 1s.
// Default: 10 seconds.
CheckDuration time.Duration `json:"check_duration"`
}
type DnsCacheConfig struct {
// Setting this value to `true` will enable caching of DNS queries responses used for API endpoint’s host names. By default caching is disabled.
Enabled bool `json:"enabled"`
// This setting allows you to specify a duration in seconds before the record will be removed from cache after being added to it on the first DNS query resolution of API endpoints.
// Setting `ttl` to `-1` prevents record from being expired and removed from cache on next check interval.
TTL int64 `json:"ttl"`
CheckInterval int64 `json:"-" ignored:"true"`
// controls cache cleanup interval. By convention this shouldn't be exposed to a config or env_variable_setup
// A strategy which will be used when a DNS query will reply with more than 1 IP Address per single host.
// As a DNS query response IP Addresses can have a changing order depending on DNS server balancing strategy (eg: round robin, geographically dependent origin-ip ordering, etc) this option allows you to not to limit the connection to the first host in a cached response list or prevent response caching.
//
// * `pick_first` will instruct your Tyk Gateway to connect to the first IP in a returned IP list and cache the response.
// * `random` will instruct your Tyk Gateway to connect to a random IP in a returned IP list and cache the response.
// * `no_cache` will instruct your Tyk Gateway to connect to the first IP in a returned IP list and fetch each addresses list without caching on each API endpoint DNS query.
MultipleIPsHandleStrategy IPsHandleStrategy `json:"multiple_ips_handle_strategy"`
}
type MonitorConfig struct {
// Set this to `true` to have monitors enabled in your configuration for the node.
EnableTriggerMonitors bool `json:"enable_trigger_monitors"`
Config WebHookHandlerConf `json:"configuration"`
// The trigger limit, as a percentage of the quota that must be reached in order to trigger the event, any time the quota percentage is increased the event will trigger.
GlobalTriggerLimit float64 `json:"global_trigger_limit"`
// Apply the monitoring subsystem to user keys.
MonitorUserKeys bool `json:"monitor_user_keys"`
// Apply the monitoring subsystem to organization keys.
MonitorOrgKeys bool `json:"monitor_org_keys"`
}
type WebHookHandlerConf struct {
// The method to use for the webhook.
Method string `bson:"method" json:"method"`
// The target path on which to send the request.
TargetPath string `bson:"target_path" json:"target_path"`
// The template to load in order to format the request.
TemplatePath string `bson:"template_path" json:"template_path"`
// Headers to set when firing the webhook.
HeaderList map[string]string `bson:"header_map" json:"header_map"`
// The cool-down for the event so it does not trigger again (in seconds).
EventTimeout int64 `bson:"event_timeout" json:"event_timeout"`
}
// DNSMonitorConfig configures the background DNS monitoring for worker gateways
type DNSMonitorConfig struct {
// Enable background DNS monitoring for proactive detection of MDCB DNS changes
Enabled bool `json:"enabled"`
// Check interval in seconds for DNS monitoring (default: 30)
CheckInterval int `json:"check_interval"`
}
type SlaveOptionsConfig struct {
// Set to `true` to connect a worker Gateway using RPC.
UseRPC bool `json:"use_rpc"`
// Set this option to `true` to use an SSL RPC connection.
UseSSL bool `json:"use_ssl"`
// Set this option to `true` to allow the certificate validation (certificate chain and hostname) to be skipped.
// This can be useful if you use a self-signed certificate.
SSLInsecureSkipVerify bool `json:"ssl_insecure_skip_verify"`
// Use this setting to add the URL for your MDCB or load balancer host.
ConnectionString string `json:"connection_string"`
// Your organization ID to connect to the MDCB installation.
RPCKey string `json:"rpc_key"`
// This the API key of a user used to authenticate and authorize the Gateway’s access through MDCB.
// The user should be a standard Dashboard user with minimal privileges so as to reduce any risk if the user is compromised.
// The suggested security settings are read for Real-time notifications and the remaining options set to deny.
APIKey string `json:"api_key"`
// Set this option to `true` to enable RPC caching for keys.
EnableRPCCache bool `json:"enable_rpc_cache"`
// For an Self-Managed installation this can be left at `false` (the default setting). For Legacy Cloud Gateways it must be set to ‘true’.
BindToSlugsInsteadOfListenPaths bool `json:"bind_to_slugs"`
// Set this option to `true` if you don’t want to monitor changes in the keys from a primary Gateway.
DisableKeySpaceSync bool `json:"disable_keyspace_sync"`
// This is the `zone` that this instance inhabits, e.g. the cluster/data-center the Gateway lives in.
// The group ID must be the same across all the Gateways of a data-center/cluster which are also sharing the same Redis instance.
// This ID should also be unique per cluster (otherwise another Gateway cluster can pick up your keyspace events and your cluster will get zero updates).
GroupID string `json:"group_id"`
// Call Timeout allows to specify a time in seconds for the maximum allowed duration of a RPC call.
CallTimeout int `json:"call_timeout"`
// The maximum time in seconds that a RPC ping can last.
PingTimeout int `json:"ping_timeout"`
// The number of RPC connections in the pool. Basically it creates a set of connections that you can re-use as needed. Defaults to 5.
RPCPoolSize int `json:"rpc_pool_size"`
// You can use this to set a period for which the Gateway will check if there are changes in keys that must be synchronized. If this value is not set then it will default to 10 seconds.
KeySpaceSyncInterval float32 `json:"key_space_sync_interval"`
// RPCCertCacheExpiration defines the expiration time of the rpc cache that stores the certificates, defined in seconds
RPCCertCacheExpiration float32 `json:"rpc_cert_cache_expiration"`
// RPCKeysCacheExpiration defines the expiration time of the rpc cache that stores the keys, defined in seconds
RPCGlobalCacheExpiration float32 `json:"rpc_global_cache_expiration"`
// SynchroniserEnabled enable this config if MDCB has enabled the synchoniser. If disabled then it will ignore signals to synchonise recources
SynchroniserEnabled bool `json:"synchroniser_enabled"`
// DNSMonitor configures background DNS monitoring for proactive detection of MDCB DNS changes
DNSMonitor DNSMonitorConfig `json:"dns_monitor"`
}
type LocalSessionCacheConf struct {
// By default sessions are set to cache. Set this to `true` to stop Tyk from caching keys locally on the node.
DisableCacheSessionState bool `json:"disable_cached_session_state"`
CachedSessionTimeout int `json:"cached_session_timeout"`
CacheSessionEviction int `json:"cached_session_eviction"`
}
type CertsData []CertData
func (certs *CertsData) Decode(value string) error {
err := json.Unmarshal([]byte(value), certs)
if err != nil {
log.Error("Error unmarshalling TYK_GW_HTTPSERVEROPTIONS_CERTIFICATES: ", err)
return err
}
return nil
}
type HttpServerOptionsConfig struct {
// No longer used
OverrideDefaults bool `json:"-"`
// API Consumer -> Gateway network read timeout. Not setting this config, or setting this to 0, defaults to 120 seconds
ReadTimeout int `json:"read_timeout"`
// API Consumer -> Gateway network write timeout. Not setting this config, or setting this to 0, defaults to 120 seconds
//
// Note:
// If you set `proxy_default_timeout` to a value greater than 120 seconds, you must also increase [http_server_options.write_timeout](#http-server-options-write-timeout) to a value greater than `proxy_default_timeout`. The `write_timeout` setting defaults to 120 seconds and controls how long Tyk waits to write the response back to the client. If not adjusted, the client connection will be closed before the upstream response is received.
WriteTimeout int `json:"write_timeout"`
// Set to true to enable SSL connections
UseSSL bool `json:"use_ssl"`
// Enable HTTP2 protocol handling
EnableHttp2 bool `json:"enable_http2"`
// EnableStrictRoutes changes the routing to avoid nearest-neighbour requests on overlapping routes
//
// - if disabled, `/apple` will route to `/app`, the current default behavior,
// - if enabled, `/app` only responds to `/app`, `/app/` and `/app/*` but not `/apple`
//
// Regular expressions and parameterized routes will be left alone regardless of this setting.
EnableStrictRoutes bool `json:"enable_strict_routes"`
// EnablePathPrefixMatching changes how the gateway matches incoming URL paths against routes (patterns) defined in the API definition.
// By default, the gateway uses wildcard matching. When EnablePathPrefixMatching is enabled, it switches to prefix matching. For example, a defined path such as `/json` will only match request URLs that begin with `/json`, rather than matching any URL containing `/json`.
//
// The gateway checks the request URL against several variations depending on whether path versioning is enabled:
// - Full path (listen path + version + endpoint): `/listen-path/v4/json`
// - Non-versioned full path (listen path + endpoint): `/listen-path/json`
// - Path without version (endpoint only): `/json`
//
// For patterns that start with `/`, the gateway prepends `^` before performing the check, ensuring a true prefix match.
// For patterns that start with `^`, the gateway will already perform prefix matching so EnablePathPrefixMatching will have no impact.
// This option allows for more specific and controlled routing of API requests, potentially reducing unintended matches. Note that you may need to adjust existing route definitions when enabling this option.
//
// Example:
//
// With wildcard matching, `/json` might match `/api/v1/data/json`.
// With prefix matching, `/json` would not match `/api/v1/data/json`, but would match `/json/data`.
//
// Combining EnablePathPrefixMatching with EnablePathSuffixMatching will result in exact URL matching, with `/json` being evaluated as `^/json$`.
EnablePathPrefixMatching bool `json:"enable_path_prefix_matching"`
// EnablePathSuffixMatching changes how the gateway matches incoming URL paths against routes (patterns) defined in the API definition.
// By default, the gateway uses wildcard matching. When EnablePathSuffixMatching is enabled, it switches to suffix matching. For example, a defined path such as `/json` will only match request URLs that end with `/json`, rather than matching any URL containing `/json`.
//
// The gateway checks the request URL against several variations depending on whether path versioning is enabled:
// - Full path (listen path + version + endpoint): `/listen-path/v4/json`
// - Non-versioned full path (listen path + endpoint): `/listen-path/json`
// - Path without version (endpoint only): `/json`
//
// For patterns that already end with `$`, the gateway will already perform suffix matching so EnablePathSuffixMatching will have no impact. For all other patterns, the gateway appends `$` before performing the check, ensuring a true suffix match.
// This option allows for more specific and controlled routing of API requests, potentially reducing unintended matches. Note that you may need to adjust existing route definitions when enabling this option.
//
// Example:
//
// With wildcard matching, `/json` might match `/api/v1/json/data`.
// With suffix matching, `/json` would not match `/api/v1/json/data`, but would match `/api/v1/json`.
//
// Combining EnablePathSuffixMatching with EnablePathPrefixMatching will result in exact URL matching, with `/json` being evaluated as `^/json$`.
EnablePathSuffixMatching bool `json:"enable_path_suffix_matching"`
// Disable TLS verification. Required if you are using self-signed certificates.
SSLInsecureSkipVerify bool `json:"ssl_insecure_skip_verify"`
// Enabled WebSockets and server side events support
EnableWebSockets bool `json:"enable_websockets"`
// Deprecated: Use `ssl_certificates`instead.
Certificates CertsData `json:"certificates"`
// Index of certificates available to the Gateway for use in client and upstream communication.
// The string value in the array can be two of the following options:
// 1. The ID assigned to and used to identify a certificate in the Tyk Certificate Store
// 2. The path to a file accessible to the Gateway. This PEM file must contain the private key and public certificate pair concatenated together.
SSLCertificates []string `json:"ssl_certificates"`
// Start your Gateway HTTP server on specific server name
ServerName string `json:"server_name"`
// Minimum TLS version. Possible values: https://tyk.io/docs/api-management/certificates#supported-tls-versions
MinVersion uint16 `json:"min_version"`
// Maximum TLS version.
MaxVersion uint16 `json:"max_version"`
// When mTLS enabled, this option allows to skip client CA announcement in the TLS handshake.
// This option is useful when you have a lot of ClientCAs and you want to reduce the handshake overhead, as some clients can hit TLS handshake limits.
// This option does not give any hints to the client, on which certificate to pick (but this is very rare situation when it is required)
SkipClientCAAnnouncement bool `json:"skip_client_ca_announcement"`
// Set this to the number of seconds that Tyk uses to flush content from the proxied upstream connection to the open downstream connection.
// This option needed be set for streaming protocols like Server Side Events, or gRPC streaming.
FlushInterval int `json:"flush_interval"`
// Allow the use of a double slash in a URL path. This can be useful if you need to pass raw URLs to your API endpoints.
// For example: `http://myapi.com/get/http://example.com`.
SkipURLCleaning bool `json:"skip_url_cleaning"`
// Disable automatic character escaping, allowing to path original URL data to the upstream.
SkipTargetPathEscaping bool `json:"skip_target_path_escaping"`
// Custom SSL ciphers applicable when using TLS version 1.2. See the list of ciphers here https://tyk.io/docs/api-management/certificates#supported-tls-cipher-suites
Ciphers []string `json:"ssl_ciphers"`
// MaxRequestBodySize configures a maximum size limit for request body size (in bytes) for all APIs on the Gateway.
//
// Tyk Gateway will evaluate all API requests against this size limit and will respond with HTTP 413 status code if the body of the request is larger.
//
// Two methods are used to perform the comparison:
// - If the API Request contains the `Content-Length` header, this is directly compared against `MaxRequestBodySize`.
// - If the `Content-Length` header is not provided, the Request body is read in chunks to compare total size against `MaxRequestBodySize`.
//
// A value of zero (default) means that no maximum is set and API requests will not be tested.
//
// See more information about setting request size limits here:
// https://tyk.io/docs/api-management/traffic-transformation/#request-size-limits
MaxRequestBodySize int64 `json:"max_request_body_size"`
// XFFDepth controls which position in the X-Forwarded-For chain to use for determining client IP address.
// A value of 0 means using the first IP (default). this is way the Gateway has calculated the client IP historically,
// the most common case, and will be used when this config is not set.
// However, any non-zero value will use that position from the right in the X-Forwarded-For chain.
// This is a security feature to prevent against IP spoofing attacks, and is recommended to be set to a non-zero value.
// A value of 1 means using the last IP, 2 means second to last, and so on.
XFFDepth int `json:"xff_depth"`
// MaxResponseBodySize sets an upper limit on the response body (payload) size in bytes. It defaults to 0, which means there is no restriction on the response body size.
//
// The Gateway will return `HTTP 500 Response Body Too Large` if the response payload exceeds MaxResponseBodySize+1 bytes.
//
// **Note:** The limit is applied only when the [Response Body Transform middleware](/api-management/traffic-transformation/response-body) is enabled.
MaxResponseBodySize int64 `json:"max_response_body_size"`
}
type AuthOverrideConf struct {
ForceAuthProvider bool `json:"force_auth_provider"`
AuthProvider apidef.AuthProviderMeta `json:"auth_provider"`
ForceSessionProvider bool `json:"force_session_provider"`
SessionProvider apidef.SessionProviderMeta `json:"session_provider"`
}
type UptimeTestsConfigDetail struct {
// The sample size to trigger a `HostUp` or `HostDown` event. For example, a setting of 3 will require at least three failures to occur before the uptime test is triggered.
FailureTriggerSampleSize int `json:"failure_trigger_sample_size"`
// The value in seconds between tests runs. All tests will run simultaneously. This value will set the time between those tests. So a value of 60 will run all uptime tests every 60 seconds.
TimeWait int `json:"time_wait"`
// The goroutine pool size to keep idle for uptime tests. If you have many uptime tests running at a high time period, then increase this value.
CheckerPoolSize int `json:"checker_pool_size"`
// Set this value to `true` to have the node capture and record analytics data regarding the uptime tests.
EnableUptimeAnalytics bool `json:"enable_uptime_analytics"`
}
type UptimeTestsConfig struct {
// To disable uptime tests on this node, set this value to `true`.
Disable bool `json:"disable"`
// If you have multiple Gateway clusters connected to the same Redis instance, you need to set a unique poller group for each cluster.
PollerGroup string `json:"poller_group"`
Config UptimeTestsConfigDetail `json:"config"`
}
type ServiceDiscoveryConf struct {
// Service discovery cache timeout
DefaultCacheTimeout int `json:"default_cache_timeout"`
}
type CoProcessConfig struct {
// Enable gRPC and Python plugins
EnableCoProcess bool `json:"enable_coprocess"`
// Address of gRPC user
CoProcessGRPCServer string `json:"coprocess_grpc_server"`
// Maximum message which can be received from a gRPC server
GRPCRecvMaxSize int `json:"grpc_recv_max_size"`
// Maximum message which can be sent to gRPC server
GRPCSendMaxSize int `json:"grpc_send_max_size"`
// Authority used in GRPC connection
GRPCAuthority string `json:"grpc_authority"`
// GRPCRoundRobinLoadBalancing enables round robin load balancing for gRPC services; you must provide the address of the load balanced service using `dns:///` protocol in `coprocess_grpc_server`.
GRPCRoundRobinLoadBalancing bool `json:"grpc_round_robin_load_balancing"`
// Sets the path to built-in Tyk modules. This will be part of the Python module lookup path. The value used here is the default one for most installations.
PythonPathPrefix string `json:"python_path_prefix"`
// If you have multiple Python versions installed you can specify your version.
PythonVersion string `json:"python_version"`
}
type CertificatesConfig struct {
API []string `json:"apis"`
// Upstream is used to specify the certificates to be used in mutual TLS connections to upstream services. These are set at gateway level as a map of domain -> certificate id or path.
// For example if you want Tyk to use the certificate `ab23ef123` for requests to the `example.com` upstream and `/certs/default.pem` for all other upstreams then:
// In `tyk.conf` you would configure `"security": {"certificates": {"upstream": {"*": "/certs/default.pem", "example.com": "ab23ef123"}}}`
// And if using environment variables you would set this to `*:/certs/default.pem,example.com:ab23ef123`.
Upstream map[string]string `json:"upstream"`
// Certificates used for Control API Mutual TLS
ControlAPI []string `json:"control_api"`
// Used for communicating with the Dashboard if it is configured to use Mutual TLS
Dashboard []string `json:"dashboard_api"`
// Certificates used for MDCB Mutual TLS
MDCB []string `json:"mdcb_api"`
}
// CertificateExpiryMonitorConfig configures the certificate expiration notification feature
type CertificateExpiryMonitorConfig struct {
// WarningThresholdDays specifies the number of days before certificate expiry that the Gateway will start generating CertificateExpiringSoon events when the certificate is used
// Default: DefaultWarningThresholdDays (30 days)
WarningThresholdDays int `json:"warning_threshold_days"`
// CheckCooldownSeconds specifies the minimum time in seconds that the Gateway will leave between checking for the expiry of a certificate when it is used in an API request - if a certificate is used repeatedly this prevents unnecessary expiry checks
// Default: DefaultCheckCooldownSeconds (3600 seconds = 1 hour)
CheckCooldownSeconds int `json:"check_cooldown_seconds"`
// EventCooldownSeconds specifies the minimum time in seconds between firing the same certificate expiry event - this prevents unnecessary events from being generated for an expiring or expired certificate being used repeatedly; note that the higher of the value configured here or the default (DefaultEventCooldownSeconds) will be applied
// Default: DefaultEventCooldownSeconds (86400 seconds = 24 hours)
EventCooldownSeconds int `json:"event_cooldown_seconds"`
}
type SecurityConfig struct {
// Set the AES256 secret which is used to encode certificate private keys when they uploaded via certificate storage
PrivateCertificateEncodingSecret string `json:"private_certificate_encoding_secret"`
// Enable Gateway Control API to use Mutual TLS. Certificates can be set via `security.certificates.control_api` section
ControlAPIUseMutualTLS bool `json:"control_api_use_mutual_tls"`
// Specify public keys used for Certificate Pinning on global level.
PinnedPublicKeys map[string]string `json:"pinned_public_keys"`
// AllowUnsafeDynamicMTLSToken controls whether certificate presence is required for
// dynamic mTLS authentication. If set to false (default), requests with a token but
// no certificate will be rejected for APIs using dynamic mTLS.
AllowUnsafeDynamicMTLSToken bool `json:"allow_unsafe_dynamic_mtls_token"`
Certificates CertificatesConfig `json:"certificates"`
// CertificateExpiryMonitor configures the certificate expiry monitoring and notification feature
CertificateExpiryMonitor CertificateExpiryMonitorConfig `json:"certificate_expiry_monitor"`
}
type NewRelicConfig struct {
// New Relic Application name
AppName string `json:"app_name"`
// New Relic License key
LicenseKey string `json:"license_key"`
// Enable distributed tracing
EnableDistributedTracing bool `json:"enable_distributed_tracing"`
}
type Tracer struct {
// The name of the tracer to initialize. For instance appdash, to use appdash tracer
Name string `json:"name"`
// Enable tracing
Enabled bool `json:"enabled"`
// Tracing configuration. Refer to the Tracing Docs for the full list of options.
Options map[string]interface{} `json:"options"`
}
// ServicePort defines a protocol and port on which a service can bind to.
type ServicePort struct {
Protocol string `json:"protocol"`
Port int `json:"port"`
}
// PortWhiteList defines ports that will be allowed by the Gateway.
type PortWhiteList struct {
Ranges []PortRange `json:"ranges,omitempty"`
Ports []int `json:"ports,omitempty"`
}
// Match returns true if port is acceptable from the PortWhiteList.
func (p PortWhiteList) Match(port int) bool {
for _, v := range p.Ports {
if port == v {
return true
}
}
for _, r := range p.Ranges {
if r.Match(port) {
return true
}
}
return false
}
// PortRange defines a range of ports inclusively.
type PortRange struct {
From int `json:"from"`
To int `json:"to"`
}
// Match returns true if port is within the range
func (r PortRange) Match(port int) bool {
return r.From <= port && r.To >= port
}
type PortsWhiteList map[string]PortWhiteList
func (pwl *PortsWhiteList) Decode(value string) error {
err := json.Unmarshal([]byte(value), pwl)
if err != nil {
log.Error("Error unmarshalling TYK_GW_PORTWHITELIST: ", err)
return err
}
return nil
}
// StreamingConfig holds the configuration for Tyk Streaming functionalities
type StreamingConfig struct {
// This flag enables the Tyk Streaming feature.
Enabled bool `json:"enabled"`
// AllowUnsafe specifies a list of potentially unsafe streaming components that should be allowed in the configuration.
// By default, components that could pose security risks (like file access, subprocess execution, socket operations, etc.)
// are filtered out. This field allows administrators to explicitly permit specific unsafe components when needed.
// Use with caution as enabling unsafe components may introduce security vulnerabilities.
AllowUnsafe []string `json:"allow_unsafe"`
}
// Config is the configuration object used by Tyk to set up various parameters.
type Config struct {
// Force your Gateway to work only on a specific domain name. Can be overridden by API custom domain.
HostName string `json:"hostname"`
// If your machine has multiple network devices or IPs you can force the Gateway to use the IP address you want.
ListenAddress string `json:"listen_address"`
// Setting this value will change the port that Tyk listens on. Default: 8080.
ListenPort int `json:"listen_port"`
// Custom hostname for the Control API
ControlAPIHostname string `json:"control_api_hostname"`
// Set this to expose the Tyk Gateway API on a separate port. You can protect it behind a firewall if needed. Please make sure you follow this guide when setting the control port https://tyk.io/docs/tyk-self-managed/#change-your-control-port.
ControlAPIPort int `json:"control_api_port"`
// This should be changed as soon as Tyk is installed on your system.
// This value is used in every interaction with the Tyk Gateway API. It should be passed along as the X-Tyk-Authorization header in any requests made.
// Tyk assumes that you are sensible enough not to expose the management endpoints publicly and to keep this configuration value to yourself.
Secret string `json:"secret"`
// The shared secret between the Gateway and the Dashboard to ensure that API Definition downloads, heartbeat and Policy loads are from a valid source.
NodeSecret string `json:"node_secret"`
// Linux PID file location. Do not change unless you know what you are doing. Default: /var/run/tyk/tyk-gateway.pid
PIDFileLocation string `json:"pid_file_location"`
// Can be set to disable Dashboard message signature verification. When set to `true`, `public_key_path` can be ignored.
AllowInsecureConfigs bool `json:"allow_insecure_configs"`
// While communicating with the Dashboard. By default, all messages are signed by a private/public key pair. Set path to public key.
PublicKeyPath string `json:"public_key_path"`
// Allow your Dashboard to remotely set Gateway configuration via the Nodes screen.
AllowRemoteConfig bool `bson:"allow_remote_config" json:"allow_remote_config"`
// Global Certificate configuration
Security SecurityConfig `json:"security"`
// External service configuration for proxy and mTLS support
ExternalServices ExternalServiceConfig `json:"external_services"`
// Gateway HTTP server configuration
HttpServerOptions HttpServerOptionsConfig `json:"http_server_options"`
// Expose version header with a given name. Works only for versioned APIs.
VersionHeader string `json:"version_header"`
// Disable dynamic API and Policy reloads, e.g. it will load new changes only on procecss start.
SuppressRedisSignalReload bool `json:"suppress_redis_signal_reload"`
// ReloadInterval defines a duration in seconds within which the gateway responds to a reload event.
// The value defaults to 1, values lower than 1 are ignored.
ReloadInterval int64 `json:"reload_interval"`
// Enable Key hashing
HashKeys bool `json:"hash_keys"`
// DisableKeyActionsByUsername disables key search by username.
// When this is set to `true` you are able to search for keys only by keyID or key hash (if `hash_keys` is also set to `true`)
// Note that if `hash_keys` is also set to `true` then the keyID will not be provided for APIs secured using basic auth. In this scenario the only search option would be to use key hash
// If you are using the Tyk Dashboard, you must configure this setting with the same value in both Gateway and Dashboard
DisableKeyActionsByUsername bool `json:"disable_key_actions_by_username"`
// Specify the Key hashing algorithm. Possible values: murmur64, murmur128, sha256.
HashKeyFunction string `json:"hash_key_function"`
// Specify the Key hashing algorithm for "basic auth". Possible values: murmur64, murmur128, sha256, bcrypt.
// Will default to "bcrypt" if not set.
BasicAuthHashKeyFunction string `json:"basic_auth_hash_key_function"`
// Specify your previous key hashing algorithm if you migrated from one algorithm to another.
HashKeyFunctionFallback []string `json:"hash_key_function_fallback"`
// Allows the listing of hashed API keys
EnableHashedKeysListing bool `json:"enable_hashed_keys_listing"`
// Minimum API token length
MinTokenLength int `json:"min_token_length"`
// Path to error and webhook templates. Defaults to the current binary path.
TemplatePath string `json:"template_path"`
// The policies section allows you to define where Tyk can find its policy templates. Policy templates are similar to key definitions in that they allow you to set quotas, access rights and rate limits for keys.
// Policies are loaded when Tyk starts and if changed require a hot-reload so they are loaded into memory.
// A policy can be defined in a file (Open Source installations) or from the same database as the Dashboard.
Policies PoliciesConfig `json:"policies"`
// Defines the ports that will be available for the API services to bind to in the format
// documented here https://tyk.io/docs/api-management/non-http-protocols/#allowing-specific-ports.
// Ports can be configured per protocol, e.g. https, tls etc.
// If configuring via environment variable `TYK_GW_PORTWHITELIST` then remember to escape
// JSON strings.
PortWhiteList PortsWhiteList `json:"ports_whitelist"`
// Disable port whilisting, essentially allowing you to use any port for your API.
DisablePortWhiteList bool `json:"disable_ports_whitelist"`
// If Tyk is being used in its standard configuration (Open Source installations), then API definitions are stored in the apps folder (by default in /opt/tyk-gateway/apps).
// This location is scanned for .json files and re-scanned at startup or reload.
// See the API section of the Tyk Gateway API for more details.
AppPath string `json:"app_path"`
// If you are a Tyk Pro user, this option will enable polling the Dashboard service for API definitions.
// On startup Tyk will attempt to connect and download any relevant application configurations from from your Dashboard instance.
// The files are exactly the same as the JSON files on disk with the exception of a BSON ID supplied by the Dashboard service.
UseDBAppConfigs bool `json:"use_db_app_configs"`
// This section defines API loading and shard options. Enable these settings to selectively load API definitions on a node from your Dashboard service.
DBAppConfOptions DBAppConfOptionsConfig `json:"db_app_conf_options"`
// This section defines your Redis configuration.
Storage StorageOptionsConf `json:"storage"`
// Disable the capability of the Gateway to `autodiscover` the Dashboard through heartbeat messages via Redis.
// The goal of zeroconf is auto-discovery, so you do not have to specify the Tyk Dashboard address in your Gateway`tyk.conf` file.
// In some specific cases, for example, when the Dashboard is bound to a public domain, not accessible inside an internal network, or similar, `disable_dashboard_zeroconf` can be set to `true`, in favor of directly specifying a Tyk Dashboard address.
DisableDashboardZeroConf bool `json:"disable_dashboard_zeroconf"`
// The `slave_options` allow you to configure the RPC slave connection required for MDCB installations.
// These settings must be configured for every RPC slave/worker node.
SlaveOptions SlaveOptionsConfig `json:"slave_options"`
// If set to `true`, distributed rate limiter will be disabled for this node, and it will be excluded from any rate limit calculation.
//
// Note:
// If you set `db_app_conf_options.node_is_segmented` to `true` for multiple Gateway nodes, you should ensure that `management_node` is set to `false`.
// This is to ensure visibility for the management node across all APIs.
//
// For pro installations, `management_node` is not a valid configuration option.
// Always set `management_node` to `false` in pro environments.
ManagementNode bool `json:"management_node"`
// This is used as part of the RPC / Hybrid back-end configuration in a Tyk Enterprise installation and isn’t used anywhere else.
AuthOverride AuthOverrideConf `json:"auth_override"`
// RateLimit encapsulates rate limit configuration definitions.
RateLimit
// Allows you to dynamically configure analytics expiration on a per organization level
EnforceOrgDataAge bool `json:"enforce_org_data_age"`
// Allows you to dynamically configure detailed logging on a per organization level
EnforceOrgDataDetailLogging bool `json:"enforce_org_data_detail_logging"`
// Allows you to dynamically configure organization quotas on a per organization level
EnforceOrgQuotas bool `json:"enforce_org_quotas"`
ExperimentalProcessOrgOffThread bool `json:"experimental_process_org_off_thread"`
// The monitor section is useful if you wish to enforce a global trigger limit on organization and user quotas.
// This feature will trigger a webhook event to fire when specific triggers are reached.
// Triggers can be global (set in the node), by organization (set in the organization session object) or by key (set in the key session object)
//
// While Organization-level and Key-level triggers can be tiered (e.g. trigger at 10%, trigger at 20%, trigger at 80%), in the node-level configuration only a global value can be set.
// If a global value and specific trigger level are the same the trigger will only fire once:
//
// ```
// "monitor": {
// "enable_trigger_monitors": true,
// "configuration": {
// "method": "POST",
// "target_path": "http://domain.com/notify/quota-trigger",
// "template_path": "templates/monitor_template.json",
// "header_map": {
// "some-secret": "89787855"
// },
// "event_timeout": 10
// },
// "global_trigger_limit": 80.0,
// "monitor_user_keys": false,
// "monitor_org_keys": true
// },
// ```
Monitor MonitorConfig `json:"monitor"`
// Maximum idle connections, per API, between Tyk and Upstream. By default not limited.
MaxIdleConns int `bson:"max_idle_connections" json:"max_idle_connections"`
// Maximum idle connections, per API, per upstream, between Tyk and Upstream.
// A value of `0` will use the default from the Go standard library, which is 2 connections. Tyk recommends setting this value to `500` for production environments.
MaxIdleConnsPerHost int `bson:"max_idle_connections_per_host" json:"max_idle_connections_per_host"`
// Maximum connection time. If set it will force gateway reconnect to the upstream.
MaxConnTime int64 `json:"max_conn_time"`
// If set, disable keepalive between User and Tyk
CloseConnections bool `json:"close_connections"`
// Allows you to use custom domains
EnableCustomDomains bool `json:"enable_custom_domains"`
// If AllowMasterKeys is set to true, session objects (key definitions) that do not have explicit access rights set
// will be allowed by Tyk. This means that keys that are created have access to ALL APIs, which in many cases is
// unwanted behavior unless you are sure about what you are doing.
AllowMasterKeys bool `json:"allow_master_keys"`
ServiceDiscovery ServiceDiscoveryConf `json:"service_discovery"`
// Globally ignore TLS verification between Tyk and your Upstream services
ProxySSLInsecureSkipVerify bool `json:"proxy_ssl_insecure_skip_verify"`
// Enable HTTP2 support between Tyk and your upstream service. Required for gRPC.
ProxyEnableHttp2 bool `json:"proxy_enable_http2"`
// Minimum TLS version for connection between Tyk and your upstream service.
ProxySSLMinVersion uint16 `json:"proxy_ssl_min_version"`