startup

package
v2.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 8 Imported by: 0

README

ccStartup

ccStartup is used to provide the current node topology to some central endpoint either through HTTP or NATS.

Configuration

The configuration file for the startup contains the targets where the topology should be sent to.

{
    "http": {
        "url": "http://localhost:8080/my_startup_endpoint",
        "auth_token": "my-secret-login-token"
    },
    "nats": {
        "url": "nats://localhost:4222",
        "nkey_file:": "/path/to/nkey/file/if/any",
        "subject": "my_startup_subject"
    }
}
  • http.url: Target URL for the HTTP POST request containing the node topology as JSON
  • http.auth_token: JSON Web token or :
  • nats.url: NATS server URL
  • nats.subject: NATS subject where to publish the topology as JSON
  • nats.nkey_file: Path to NKey file for authentification

The auth token need not be stored in the configuration file. It is also read from $CC_STARTUP_AUTH_TOKEN, or from the file named by $CC_STARTUP_AUTH_TOKEN_FILE, either of which takes precedence over http.auth_token. A named file that cannot be read is an error, so a request is never sent unauthenticated in its place. See the util package for the full precedence rules.

Documentation

Index

Constants

View Source
const EnvAuthToken = "CC_STARTUP_AUTH_TOKEN"

EnvAuthToken overrides the configured HTTP endpoint auth token. It also accepts a "_FILE" variant naming a file that holds the token, so the token can come from a Docker or Kubernetes secret mount or from systemd LoadCredential; see util.SecretFromEnv for the precedence rules.

The name is prefixed CC_ because cc-lib is linked into several applications, whose environments it must not silently claim names in.

Variables

This section is empty.

Functions

func CCStartup

func CCStartup(config json.RawMessage) error

Types

type CCStartupConfig

type CCStartupConfig struct {
	SendTopology bool `json:"send_topology,omitempty"`
	HttpEndpoint struct {
		URL       string `json:"url"`
		AuthToken string `json:"auth_token"`
	} `json:"http"`
	NatsEndpoint struct {
		URL      string `json:"url"`
		Subject  string `json:"subject"`
		NkeyFile string `json:"nkey_file"`
	} `json:"nats"`
}

Jump to

Keyboard shortcuts

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