mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-06-05 23:03:48 +00:00
Improve tests and speed things up a little.
This commit is contained in:
+10
@@ -38,6 +38,7 @@ var introspection_queries = []string{
|
||||
|
||||
var introspectionQuerySet = map[string]struct{}{}
|
||||
var introspectionAllowedQueries = map[string]struct{}{}
|
||||
var allowedUrls = map[string]struct{}{}
|
||||
|
||||
func prepareQueriesAndExemptions() {
|
||||
introspectionQuerySet = map[string]struct{}{}
|
||||
@@ -57,6 +58,15 @@ func prepareQueriesAndExemptions() {
|
||||
}
|
||||
return rsqs
|
||||
}()
|
||||
|
||||
allowedUrls = map[string]struct{}{}
|
||||
allowedUrls = func() map[string]struct{} {
|
||||
rsqs := make(map[string]struct{}, len(cfg.Server.AllowURLs))
|
||||
for _, query := range cfg.Server.AllowURLs {
|
||||
rsqs[strings.ToLower(query)] = struct{}{}
|
||||
}
|
||||
return rsqs
|
||||
}()
|
||||
}
|
||||
|
||||
func parseGraphQLQuery(c *fiber.Ctx) (operationType, operationName string, cacheRequest bool, cache_time int, should_block bool, should_ignore bool) {
|
||||
|
||||
Reference in New Issue
Block a user