TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.76k stars 1.09k forks source link

Expose /env and /config for Configuration reporting #6652

Open letzya opened 1 month ago

letzya commented 1 month ago

Description

Related Issue

Motivation and Context

How This Has Been Tested

These endpoints are a control port and a dedicated API key

// /env
~ » curl  -H "X-Tyk-Authorization: topsecret" 'http://localhost:8181/env' | jq '.[]' |grep -i cache

// /env?env=<env name>
~ » curl -s  -H "X-Tyk-Authorization: topsecret" 'http://localhost:8181/env?env=TYK_GW_CACHESTORAGE_PORT' | jq .
{
  "config_field": "cache_storage.port",
  "env": "TYK_GW_CACHESTORAGE_PORT",
  "value": "0",
  "obfuscated": false
}

// /config
~ » curl -s -H "X-Tyk-Authorization: topsecret" 'http://localhost:8181/config' | jq .cache_storage
{
  "type": "",
  "host": "",
  "port": 0,
  "hosts": {},
  "addrs": null,
  "master_name": "",
  "sentinel_password": "",
  "username": "",
  "password": "",
  "database": 0,
  "optimisation_max_idle": 0,
  "optimisation_max_active": 0,
  "timeout": 0,
  "enable_cluster": false,
  "use_ssl": false,
  "ssl_insecure_skip_verify": false,
  "ca_file": "",
  "cert_file": "",
  "key_file": "",
  "tls_max_version": "",
  "tls_min_version": ""
}

Screenshots (if appropriate)

Types of changes

Checklist