application

package
v8.10.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package application providers helpers used by the command-line entry points of all versions of Relay.

Index

Constants

View Source
const DefaultConfigPath = "/etc/ld-relay.conf"

DefaultConfigPath is the default configuration file path.

Variables

This section is empty.

Functions

func DescribeRelayVersion

func DescribeRelayVersion(version string) string

DescribeRelayVersion returns the same version string unless it is a prerelease build, in which case it is reformatted to change "+xxx" into "(build xxx)".

func StartHTTPServer

func StartHTTPServer(
	port int,
	handler http.Handler,
	tlsEnabled bool,
	tlsCertFile, tlsKeyFile string,
	tlsMinVersion uint16,
	loggers ldlog.Loggers,
) (*http.Server, <-chan error)

StartHTTPServer starts the server, with or without TLS. It returns immediately, starting the server on a separate goroutine; if the server fails to start up, it sends an error to the error channel.

Types

type Options

type Options struct {
	ConfigFile       string
	AllowMissingFile bool
	UseEnvironment   bool
	PrintVersion     bool
}

Options represents all options that can be set from the command line.

func ReadOptions

func ReadOptions(osArgs []string, errorOutput io.Writer) (Options, error)

ReadOptions reads and validates the command-line options.

The configuration parameter behavior is as follows:

1. If you specify --version, relay prints a line to standard out of its current version and stop execution, instead of doing anything below. 2. If you specify --config $FILEPATH, it loads that file. Failure to find it or parse it is a fatal error, unless you also specify --allow-missing-file. 3. If you specify --from-env, it creates a configuration from environment variables as described in README. 4. If you specify both, the file is loaded first, then it applies changes from variables if any. 5. Omitting all options is equivalent to explicitly specifying --config /etc/ld-relay.conf.

func (Options) DescribeConfigSource

func (o Options) DescribeConfigSource() string

DescribeConfigSource returns a human-readable phrase describing whether the configuration comes from a file, from variables, or both.

Jump to

Keyboard shortcuts

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