env

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package env contains common command line and initialization code for SCION services. If something is specific to one app, it should go into that app's code and not here.

During initialization, SIGHUPs are masked. To call a function on each SIGHUP, pass the function when calling Init.

Index

Constants

View Source
const (
	DefaultLoggingLevel = "info"
	// Default max size of log files in MiB
	DefaultLoggingFileSize = 50
	// Default max age of log file in days
	DefaultLoggingFileMaxAge = 7
	// Default file name for topology file (only the last element of the path)
	DefaultTopologyPath = "topology.json"
)

Variables

This section is empty.

Functions

func InitGeneral

func InitGeneral(cfg *General) error

func InitLogging

func InitLogging(cfg *Logging) error

InitLogging initializes logging and sets the root logger Log.

Types

type Env

type Env struct {
	// AppShutdownSignal is closed when the process receives a signal to close
	// (e.g., SIGTERM).
	AppShutdownSignal chan struct{}
}

func SetupEnv

func SetupEnv(reloadF func()) *Env

type General

type General struct {
	// ID is the SCION element ID. This is used to choose the relevant
	// portion of the topology file for some services.
	ID string
	// ConfigDir for loading extra files (currently, only topology.json)
	ConfigDir string
	// TopologyPath is the file path for the local topology JSON file.
	TopologyPath string `toml:"Topology"`
	// Topology is the loaded topology file.
	Topology *topology.Topo `toml:"-"`
}

type Infra

type Infra struct {
	// Type must be one of BS, CS or PS.
	Type string
}

Infra contains information that is BS, CS, PS specific.

type Logging

type Logging struct {
	File struct {
		// Path is the location of the logging file. If unset, no file logging
		// is performed.
		Path string
		// Level of file logging (defaults to DefaultLoggingLevel).
		Level string
		// Size is the max size of log file in MiB (defaults to DefaultLoggingFileSize)
		Size uint
		// Max age of log file in days (defaults to DefaultLoggingFileMaxAge)
		MaxAge uint
		// FlushInterval specifies how frequently to flush to the log file,
		// in seconds
		FlushInterval int
	}

	Console struct {
		// Level of console logging. If unset, no console logging is
		// performed.
		Level string
	}
}

type Metrics

type Metrics struct {
	// Prometheus contains the address to export prometheus metrics on. If
	// not set, metrics are not exported.
	Prometheus string
}

func (*Metrics) StartPrometheus added in v0.1.1

func (cfg *Metrics) StartPrometheus(fatalC chan error)

type Trust

type Trust struct {
	// TrustDB is the database for trust information.
	TrustDB string
}

Trust contains information that is BS, CS, PS, SD specific.

Jump to

Keyboard shortcuts

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