Skip to content

Commit

Permalink
Config: Expose merged configuration for easier debugging (#6049)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalouf authored Jul 8, 2024
1 parent 1b29523 commit b3c7bca
Show file tree
Hide file tree
Showing 11 changed files with 1,136 additions and 1,021 deletions.
9 changes: 9 additions & 0 deletions cmd/algod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package main

import (
"encoding/json"
"flag"
"fmt"
"math/rand"
Expand Down Expand Up @@ -174,6 +175,14 @@ func run() int {
log.Fatalf("Cannot load config: %v", err)
}

// log is not setup yet
fmt.Printf("Config loaded from %s\n", absolutePath)
fmt.Println("Configuration after loading/defaults merge: ")
err = json.NewEncoder(os.Stdout).Encode(cfg)
if err != nil {
fmt.Println("Error encoding config: ", err)
}

// set soft memory limit, if configured
if cfg.GoMemLimit > 0 {
debug.SetMemoryLimit(int64(cfg.GoMemLimit))
Expand Down
27 changes: 27 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,33 @@
}
}
},
"/debug/settings/config": {
"get": {
"description": "Returns the merged (defaults + overrides) config file in json.",
"tags": [
"private"
],
"produces": [
"application/json"
],
"schemes": [
"http"
],
"summary": "Gets the merged config file.",
"operationId": "GetConfig",
"responses": {
"200": {
"description": "The merged config file in json.",
"schema": {
"type": "string"
}
},
"default": {
"description": "Unknown Error"
}
}
}
},
"/v2/accounts/{address}": {
"get": {
"description": "Given a specific account public key, this call returns the accounts status, balance and spendable amounts",
Expand Down
26 changes: 26 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2788,6 +2788,32 @@
},
"openapi": "3.0.1",
"paths": {
"/debug/settings/config": {
"get": {
"description": "Returns the merged (defaults + overrides) config file in json.",
"operationId": "GetConfig",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
},
"description": "The merged config file in json."
},
"default": {
"content": {},
"description": "Unknown Error"
}
},
"summary": "Gets the merged config file.",
"tags": [
"private"
]
}
},
"/debug/settings/pprof": {
"get": {
"description": "Retrieves the current settings for blocking and mutex profiles",
Expand Down
30 changes: 15 additions & 15 deletions daemon/algod/api/server/v2/generated/data/routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b3c7bca

Please sign in to comment.