Documentation ¶
Overview ¶
Package runtimectl provides the RuntimeCtl facility which allows external runtime control of Granitic applications.
This facility is described in detail at https://granitic.io/ref/runtime-control Refer to the ctl package documentation for information on how to implement your own commands.
Enabling runtime control ¶
Enabling the RuntimeCtl facility creates an HTTP server that allows instructions to be issued to any component in the IoC container which implements the ctl.Command interface from the grnc-ctl command line tool. See https://granitic.io/ref/runtime-control-built-in for documentation on Granitic's built-in commands.
The HTTP server that listens for commands is separate to the HTTP server created by the XMLWs and JSONWs facilities and runs on a different port. The listen port defaults to 9099 but can be changed with the following configuration:
{ "RuntimeCtl": { "Server":{ "Port": 9099, "Address": "127.0.0.1" } } }
Note that by default the server only listens on the IPV4 localhost. To listen on all interfaces, change address to ""
Disabling individual commands ¶
You can disable individual commands (either builtin commands or your own application commands) with configuration. For example:
{ "RuntimeCtl": { "Manager":{ "Disabled": ["shutdown"] } } }
Disables the shutdown command, preventing your application being stopped remotely.
Index ¶
Constants ¶
const ( // All indicates that all components (framework and application) should be included All = iota // FrameworkOwned indicates that only components owned by Granitic should be included FrameworkOwned // ApplicationOwned indicates that only components owned by the application should be included ApplicationOwned )
const ( // Server is the component name that will be used for the runtime control server Server = instance.FrameworkPrefix + "CtlServer" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FacilityBuilder ¶
type FacilityBuilder struct { }
FacilityBuilder creates and configures the RuntimeCtl facility.
func (*FacilityBuilder) BuildAndRegister ¶
func (fb *FacilityBuilder) BuildAndRegister(lm *logging.ComponentLoggerManager, ca *config.Accessor, cc *ioc.ComponentContainer) error
BuildAndRegister creates new instances of the structs that make up the RuntimeCtl facility, configures them and adds them to the IOC container.
func (*FacilityBuilder) DependsOnFacilities ¶
func (fb *FacilityBuilder) DependsOnFacilities() []string
DependsOnFacilities returns the list of other facilities that must be running in order to use RuntimeCtl (none)
func (*FacilityBuilder) FacilityName ¶
func (fb *FacilityBuilder) FacilityName() string
FacilityName returns the canonical name of this facility (RuntimeCtl)