app

package
v0.0.386 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

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]interface{} `toml:"settings,omitempty"`
	Builtin           string                 `toml:"builtin,omitempty"`
	Dockerfile        string                 `toml:"dockerfile,omitempty"`
	DockerBuildTarget string                 `toml:"buildpacks,omitempty"`
}

type Config

type Config struct {
	AppName       string                      `toml:"app,omitempty"`
	Build         *Build                      `toml:"build,omitempty"`
	HttpService   *HttpService                `toml:"http_service,omitempty"`
	Definition    map[string]interface{}      `toml:"definition,omitempty"`
	Path          string                      `toml:"path,omitempty"`
	Services      []api.MachineService        `toml:"services"`
	Env           map[string]string           `toml:"env" json:"env"`
	Metrics       *api.MachineMetrics         `toml:"metrics" json:"metrics"`
	Statics       []*Static                   `toml:"statics,omitempty" json:"statics"`
	Deploy        *Deploy                     `toml:"deploy, omitempty"`
	PrimaryRegion string                      `toml:"primary_region,omitempty"`
	Checks        map[string]api.MachineCheck `toml:"checks,omitempty"`
	// contains filtered or unexported fields
}

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, platformVersion 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) DeterminePlatform added in v0.0.343

func (c *Config) DeterminePlatform(ctx context.Context, r io.ReadSeeker) (err error)

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) ForMachines added in v0.0.343

func (c *Config) ForMachines() bool

ForMachines is true when the config is intended for the machines platform

func (*Config) GetEnvVariables added in v0.0.335

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

func (*Config) HasBuilder

func (ac *Config) HasBuilder() bool

func (*Config) HasBuiltin

func (ac *Config) HasBuiltin() bool

func (*Config) HasDefinition

func (c *Config) HasDefinition() bool

func (*Config) HasServices

func (c *Config) HasServices() bool

HasServices - Does this config have a services section

func (*Config) Image

func (ac *Config) Image() string

func (*Config) InternalPort

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

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) SetMachinesPlatform added in v0.0.343

func (c *Config) SetMachinesPlatform()

SetMachinesPlatform informs the TOML marshaller that this config is for the machines platform

func (*Config) SetNomadPlatform added in v0.0.343

func (c *Config) SetNomadPlatform()

SetNomadPlatform informs the TOML marshaller that this config is for the nomad platform

func (*Config) SetPlatformVersion added in v0.0.344

func (c *Config) SetPlatformVersion(platform 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() (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"`
}

type HttpService added in v0.0.337

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 SlimConfig added in v0.0.342

type SlimConfig struct {
	AppName string `toml:"app,omitempty"`
}

Use this type to unmarshal fly.toml with the goal of retreiving the app name only

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 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