Skip to content

Commit

Permalink
rename field
Browse files Browse the repository at this point in the history
  • Loading branch information
letzya committed Oct 20, 2024
1 parent 5e8d5d7 commit 5f84619
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ type SecurityConfig struct {
Certificates CertificatesConfig `json:"certificates"`
}

type ConfigurationReportingCfg struct {
type ConfigurationInspectionCfg struct {

// Enable controls the availability of HTTP endpoints for monitoring and debugging Tyk Gateway.
// These endpoints provide critical system information and are disabled by default for security reasons.
Expand Down Expand Up @@ -702,7 +702,7 @@ type Config struct {
// Set to run your Gateway Control API on a separate port, and protect it behind a firewall if needed. Please make sure you follow this guide when setting the control port https://tyk.io/docs/planning-for-production/#change-your-control-port.
ControlAPIPort int `json:"control_api_port"`

ConfigurationReporting ConfigurationReportingCfg `json:"configuration_reporting"`
ConfigurationInspection ConfigurationInspectionCfg `json:"configuration_inspection"`

// 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.
Expand Down
13 changes: 7 additions & 6 deletions gateway/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1987,20 +1987,21 @@ func (gw *Gateway) loadConfigurationAPI() error {
config := gw.GetConfig()

// Check if enabled
if config.ConfigurationReporting.Enable != true {
if config.ConfigurationInspection.Enable != true {
mainLog.Info("configuration Reporting API is disabled in the configuration. Please enable it if you need to use it")
return nil
}
mainLog.Info("configuration Reporting API is enabled")

port := strconv.Itoa(config.ConfigurationReporting.APIPort)
port := strconv.Itoa(config.ConfigurationInspection.APIPort)
// Check the port
if port == "" {
return fmt.Errorf("configuration Reporting API port is not set. Please set it in order to use it")
}
mainLog.Info("configuration Reporting API Port is set to", port)

// Check the API key
if config.ConfigurationReporting.APIKey == "" {
if config.ConfigurationInspection.APIKey == "" {
return fmt.Errorf("configuration Reporting API port is not set. Please set it in order to use it")
}

Expand All @@ -2018,13 +2019,13 @@ func (gw *Gateway) loadConfigurationAPI() error {
router := mux.NewRouter()

// Define routes and middleware specific to the Config API
router.Handle("/config", authConfigurationAPI(http.HandlerFunc(v.ConfigHandler), config.ConfigurationReporting.APIKey))
router.Handle("/env", authConfigurationAPI(http.HandlerFunc(v.EnvsHandler), config.ConfigurationReporting.APIKey))
router.Handle("/config", authConfigurationAPI(http.HandlerFunc(v.ConfigHandler), config.ConfigurationInspection.APIKey))
router.Handle("/env", authConfigurationAPI(http.HandlerFunc(v.EnvsHandler), config.ConfigurationInspection.APIKey))

// muxer := &proxyMux{}
// muxer.setRouter(apiPort, "", router, gw.GetConfig())

log.Printf("Starting Configuration Reporting API on addr=%q", config.ConfigurationReporting.APIPort)
log.Printf("Starting Configuration Reporting API on addr=%d", config.ConfigurationInspection.APIPort)

var apiPort = ":" + port
if err := http.ListenAndServe(apiPort, router); err != nil {
Expand Down

0 comments on commit 5f84619

Please sign in to comment.