context

package
v0.0.0-...-68e34a6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package context is a solution for gathering all required data of the application.

Index

Constants

View Source
const (
	// IDEnvVar is the name of the environment variable which contains the current aent ID from the manifest if the aent is a registred instance.
	IDEnvVar = "PHEROMONE_ID"
	// ImageEnvVar is the name of the environment variable which contains the current aent image name.
	ImageEnvVar = "PHEROMONE_IMAGE_NAME"
	// FromContainerIDEnvVar is the name of the environment variable which contains the sender container ID which has started the recipient image.
	FromContainerIDEnvVar = "PHEROMONE_FROM_CONTAINER_ID"
	// HostnameEnvVar is the name of the environment variable which contains the recipient container id. It is populated by Docker.
	HostnameEnvVar = "HOSTNAME"
	// HostProjectDirEnvVar is the name of the environment variable which contains the host project directory path.
	HostProjectDirEnvVar = "PHEROMONE_HOST_PROJECT_DIR"
	// ContainerProjectDirEnvVar is the name of the environment variable which contains the mounted path of the host project directory.
	ContainerProjectDirEnvVar = "PHEROMONE_CONTAINER_PROJECT_DIR"
	// LogLevelEnvVar is the name of the environment variable which contains the log level.
	LogLevelEnvVar = "PHEROMONE_LOG_LEVEL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Image           string
	ID              string
	FromContainerID string
	Hostname        string
	HostProjectDir  string
	ProjectDir      string
	LogLevel        string
	// contains filtered or unexported fields
}

Context is our working struct.

func New

func New() (*Context, error)

New creates a Context instance according to where is launched the application (form a container or from the host).

func (*Context) IsContainer

func (ctx *Context) IsContainer() bool

IsContainer returns true if the application is launched from a container, false otherwise.

Jump to

Keyboard shortcuts

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