diff --git a/.changelog/4634.feature.md b/.changelog/4634.feature.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/go/control/api/api.go b/go/control/api/api.go index a3ca60bf02c..a2c7b28b0fd 100644 --- a/go/control/api/api.go +++ b/go/control/api/api.go @@ -58,6 +58,9 @@ type Status struct { // SoftwareVersion is the oasis-node software version. SoftwareVersion string `json:"software_version"` + // Debug is the oasis-node debug status. + Debug *DebugStatus `json:"debug,omitempty"` + // Identity is the identity of the node. Identity IdentityStatus `json:"identity"` @@ -74,6 +77,18 @@ type Status struct { PendingUpgrades []*upgrade.PendingUpgrade `json:"pending_upgrades"` } +// DebugStatus is the current node debug status, listing the various node +// debug options if enabled. +type DebugStatus struct { + // Enabled is true iff the node is running with DebugDontBlameOasis + // set. + Enabled bool `json:"enabled"` + + // AllowRoot is true iff the node is running with DebugAllowRoot + // set. + AllowRoot bool `json:"allow_root"` +} + // IdentityStatus is the current node identity status, listing all the public keys that identify // this node in different contexts. type IdentityStatus struct { diff --git a/go/control/control.go b/go/control/control.go index 48189b44fc0..762ae1a737e 100644 --- a/go/control/control.go +++ b/go/control/control.go @@ -8,6 +8,7 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/version" consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" control "github.com/oasisprotocol/oasis-core/go/control/api" + cmdFlags "github.com/oasisprotocol/oasis-core/go/oasis-node/cmd/common/flags" upgrade "github.com/oasisprotocol/oasis-core/go/upgrade/api" ) @@ -104,8 +105,17 @@ func (c *nodeController) GetStatus(ctx context.Context) (*control.Status, error) ident := c.node.GetIdentity() + var ds *control.DebugStatus + if debugEnabled := cmdFlags.DebugDontBlameOasis(); debugEnabled { + ds = &control.DebugStatus{ + Enabled: debugEnabled, + AllowRoot: cmdFlags.DebugAllowRoot(), + } + } + return &control.Status{ SoftwareVersion: version.SoftwareVersion, + Debug: ds, Identity: control.IdentityStatus{ Node: ident.NodeSigner.Public(), P2P: ident.P2PSigner.Public(),