runtimectl

package
v2.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

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

View Source
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
)
View Source
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

func Enabled

func Enabled(ca *config.Accessor) bool

Enabled checks to see if the RuntimeCtl facility is enabled in configuration.

func OperateOnFramework

func OperateOnFramework(args map[string]string) (bool, error)

OperateOnFramework returns true if framework components should be included in whatever command is being invoked.

Types

type FacilityBuilder

type FacilityBuilder struct {
}

FacilityBuilder creates and configures the RuntimeCtl facility.

func (*FacilityBuilder) BuildAndRegister

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL