Skip to content

Commit

Permalink
[API] AdminAPIEnabledSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed Jun 16, 2023
1 parent 7ff597c commit b975472
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,18 +937,15 @@ func (n *Node) initMetricsAPI() error {
// initAdminAPI initializes the Admin API service
// Assumes n.log, n.chainManager, and n.ValidatorAPI already initialized
func (n *Node) initAdminAPI() error {
if !n.Config.AdminAPIEnabled {
if n.Config.AdminAPIEnabledSecret == "" {
n.Log.Info("skipping admin API initialization because it has been disabled")
return nil
}

if (n.Config.HTTPHost == "localhost" || n.Config.HTTPHost == "127.0.0.1") && !n.Config.APIConfig.AllowInsecureLocalhost {
return errors.New("localhost/127.0.0.1 are considered to be insecure hosts - please explicitly allow this by also setting --http-insecure-localhost")
}

n.Log.Info("initializing admin API")
service, err := admin.NewService(
admin.Config{
Secret: n.Config.AdminAPIEnabledSecret,
Log: n.Log,
ChainManager: n.chainManager,
HTTPServer: n.APIServer,
Expand Down

0 comments on commit b975472

Please sign in to comment.