app

package
v0.0.452-pre-3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package app implements functionality related to reading and writing app configuration files.

Index

Constants

View Source
const (
	// DefaultConfigFileName denotes the default application configuration file name.
	DefaultConfigFileName = "fly.toml"
	// Config is versioned, initially, to separate nomad from machine apps without having to consult
	// the API
	NomadPlatform    = "nomad"
	MachinesPlatform = "machines"
)

Variables

This section is empty.

Functions

func NameFromContext

func NameFromContext(ctx context.Context) string

NameFromContext returns the app name ctx carries or an empty string.

func WithConfig

func WithConfig(ctx context.Context, cfg *Config) context.Context

WithConfig derives a context that carries cfg from ctx.

func WithName

func WithName(ctx context.Context, name string) context.Context

WithName derives a context that carries the given app name from ctx.

Types

type Build

type Build struct {
	Builder           string            `toml:"builder,omitempty"`
	Args              map[string]string `toml:"args,omitempty"`
	Buildpacks        []string          `toml:"buildpacks,omitempty"`
	Image             string            `toml:"image,omitempty"`
	Settings          map[string]any    `toml:"settings,omitempty"`
	Builtin           string            `toml:"builtin,omitempty"`
	Dockerfile        string            `toml:"dockerfile,omitempty"`
	Ignorefile        string            `toml:"ignorefile,omitempty"`
	DockerBuildTarget string            `toml:"build-target,omitempty"`
}

type Config

type Config struct {
	AppName       string                    `toml:"app,omitempty" json:"app,omitempty"`
	Build         *Build                    `toml:"build,omitempty" json:"build,omitempty"`
	HttpService   *HTTPService              `toml:"http_service,omitempty" json:"http_service,omitempty"`
	Definition    map[string]any            `toml:"definition,omitempty" json:"definition,omitempty"`
	Services      []Service                 `toml:"services" json:"services,omitempty"`
	Env           map[string]string         `toml:"env" json:"env,omitempty"`
	Metrics       *api.MachineMetrics       `toml:"metrics" json:"metrics,omitempty"`
	Statics       []*Static                 `toml:"statics,omitempty" json:"statics,omitempty"`
	Deploy        *Deploy                   `toml:"deploy, omitempty" json:"deploy,omitempty"`
	PrimaryRegion string                    `toml:"primary_region,omitempty" json:"primary_region,omitempty"`
	Checks        map[string]*ToplevelCheck `toml:"checks,omitempty" json:"checks,omitempty"`
	Mounts        *scanner.Volume           `toml:"mounts,omitempty" json:"mounts,omitempty"`
	Processes     map[string]string         `toml:"processes,omitempty" json:"processes,omitempty"`
	Experimental  Experimental              `toml:"experimental,omitempty" json:"experimental,omitempty"`
	FlyTomlPath   string                    `toml:"-" json:"-"`
}

Config wraps the properties of app configuration.

func ConfigFromContext

func ConfigFromContext(ctx context.Context) *Config

ConfigFromContext returns the Config ctx carries.

func LoadConfig

func LoadConfig(ctx context.Context, path string) (cfg *Config, err error)

LoadConfig loads the app config at the given path.

func NewConfig added in v0.0.335

func NewConfig() *Config

func (*Config) DockerBuildTarget

func (c *Config) DockerBuildTarget() string

func (*Config) Dockerfile

func (c *Config) Dockerfile() string

func (*Config) EncodeTo

func (c *Config) EncodeTo(w io.Writer) error

func (*Config) GetEnvVariables added in v0.0.335

func (c *Config) GetEnvVariables() map[string]string

func (*Config) GetProcessConfigs added in v0.0.452

func (c *Config) GetProcessConfigs() (map[string]*ProcessConfig, error)

func (*Config) HasBuilder

func (c *Config) HasBuilder() bool

func (*Config) HasBuiltin

func (c *Config) HasBuiltin() bool

func (*Config) HasDefinition

func (c *Config) HasDefinition() bool

func (*Config) HasNonHttpAndHttpsStandardServices added in v0.0.452

func (c *Config) HasNonHttpAndHttpsStandardServices() bool

func (*Config) HasServices

func (c *Config) HasServices() bool

HasServices - Does this config have a services section

func (*Config) HasUdpService added in v0.0.452

func (c *Config) HasUdpService() bool

func (*Config) Ignorefile added in v0.0.433

func (c *Config) Ignorefile() string

func (*Config) Image

func (c *Config) Image() string

func (*Config) InternalPort

func (c *Config) InternalPort() (int, error)

func (*Config) SetConcurrency added in v0.0.451

func (c *Config) SetConcurrency(soft int, hard int) bool

func (*Config) SetDockerCommand

func (c *Config) SetDockerCommand(cmd string)

func (*Config) SetDockerEntrypoint

func (c *Config) SetDockerEntrypoint(entrypoint string)

func (*Config) SetEnvVariable

func (c *Config) SetEnvVariable(name, value string)

func (*Config) SetEnvVariables

func (c *Config) SetEnvVariables(vals map[string]string)

func (*Config) SetInternalPort

func (c *Config) SetInternalPort(port int) bool

func (*Config) SetKillSignal

func (c *Config) SetKillSignal(signal string)

func (*Config) SetProcess

func (c *Config) SetProcess(name, value string)

func (*Config) SetReleaseCommand

func (c *Config) SetReleaseCommand(cmd string)

func (*Config) SetStatics

func (c *Config) SetStatics(statics []scanner.Static)

func (*Config) SetVolumes

func (c *Config) SetVolumes(volumes []scanner.Volume)

func (*Config) Validate added in v0.0.337

func (c *Config) Validate() (err error)

func (*Config) WriteToDisk added in v0.0.335

func (c *Config) WriteToDisk(ctx context.Context, path string) (err error)

func (*Config) WriteToFile

func (c *Config) WriteToFile(filename string) (err error)

type Deploy added in v0.0.361

type Deploy struct {
	ReleaseCommand string `toml:"release_command,omitempty"`
	Strategy       string `toml:"strategy,omitempty"`
}

type Experimental added in v0.0.452

type Experimental struct {
	Cmd          []string `toml:"cmd,omitempty"`
	Entrypoint   []string `toml:"entrypoint,omitempty"`
	Exec         []string `toml:"exec,omitempty"`
	AutoRollback bool     `toml:"auto_rollback,omitempty"`
	EnableConsul bool     `toml:"enable_consul,omitempty"`
	EnableEtcd   bool     `toml:"enable_etcd,omitempty"`
}

type HTTPService added in v0.0.452

type HTTPService struct {
	InternalPort int                            `json:"internal_port" toml:"internal_port" validate:"required,numeric"`
	ForceHttps   bool                           `toml:"force_https"`
	Concurrency  *api.MachineServiceConcurrency `toml:"concurrency,omitempty"`
}

type ProcessConfig added in v0.0.452

type ProcessConfig struct {
	Cmd      []string
	Services []api.MachineService
	Checks   map[string]api.MachineCheck
}

type Service added in v0.0.452

type Service struct {
	Protocol     string                         `json:"protocol" toml:"protocol"`
	InternalPort int                            `json:"internal_port" toml:"internal_port"`
	Ports        []api.MachinePort              `json:"ports" toml:"ports"`
	Concurrency  *api.MachineServiceConcurrency `json:"concurrency,omitempty" toml:"concurrency"`
	TCPChecks    []*ServiceTCPCheck             `json:"tcp_checks,omitempty" toml:"tcp_checks,omitempty"`
	HTTPChecks   []*ServiceHTTPCheck            `json:"http_checks,omitempty" toml:"http_checks,omitempty"`
	Processes    []string                       `json:"processes,omitempty" toml:"processes,omitempty"`
}

type ServiceHTTPCheck added in v0.0.452

type ServiceHTTPCheck struct {
	Interval          *api.Duration     `json:"interval,omitempty" toml:"interval,omitempty"`
	Timeout           *api.Duration     `json:"timeout,omitempty" toml:"timeout,omitempty"`
	HTTPMethod        *string           `json:"method,omitempty" toml:"method,omitempty"`
	HTTPPath          *string           `json:"path,omitempty" toml:"path,omitempty"`
	HTTPProtocol      *string           `json:"protocol,omitempty" toml:"protocol,omitempty"`
	HTTPTLSSkipVerify *bool             `json:"tls_skip_verify,omitempty" toml:"tls_skip_verify,omitempty"`
	HTTPHeaders       map[string]string `json:"headers,omitempty" toml:"headers,omitempty"`
}

func (*ServiceHTTPCheck) String added in v0.0.452

func (chk *ServiceHTTPCheck) String(port int) string

type ServiceTCPCheck added in v0.0.452

type ServiceTCPCheck struct {
	Interval *api.Duration `json:"interval,omitempty" toml:"interval,omitempty"`
	Timeout  *api.Duration `json:"timeout,omitempty" toml:"timeout,omitempty"`
}

func (*ServiceTCPCheck) String added in v0.0.452

func (chk *ServiceTCPCheck) String(port int) string

type Static added in v0.0.361

type Static struct {
	GuestPath string `toml:"guest_path" json:"guest_path" validate:"required"`
	UrlPrefix string `toml:"url_prefix" json:"url_prefix" validate:"required"`
}

type ToplevelCheck added in v0.0.452

type ToplevelCheck struct {
	Port              *int              `json:"port,omitempty" toml:"port,omitempty"`
	Type              *string           `json:"type,omitempty" toml:"type,omitempty"`
	Interval          *api.Duration     `json:"interval,omitempty" toml:"interval,omitempty"`
	Timeout           *api.Duration     `json:"timeout,omitempty" toml:"timeout,omitempty"`
	HTTPMethod        *string           `json:"method,omitempty" toml:"method,omitempty"`
	HTTPPath          *string           `json:"path,omitempty" toml:"path,omitempty"`
	HTTPProtocol      *string           `json:"protocol,omitempty" toml:"protocol,omitempty"`
	HTTPTLSSkipVerify *bool             `json:"tls_skip_verify,omitempty" toml:"tls_skip_verify,omitempty"`
	HTTPHeaders       map[string]string `json:"headers,omitempty" toml:"headers,omitempty"`
}

func (*ToplevelCheck) String added in v0.0.452

func (chk *ToplevelCheck) String() string

type VM added in v0.0.338

type VM struct {
	CpuCount int `toml:"cpu_count,omitempty"`
	Memory   int `toml:"memory,omitempty"`
}

Jump to

Keyboard shortcuts

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