app

package
v0.0.340 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 14 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
	NomadVersion    = 1
	MachinesVersion = 2
)

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
	Args       map[string]string
	Buildpacks []string
	// Or...
	Builtin  string
	Settings map[string]interface{}
	// Or...
	Image string
	// Or...
	Dockerfile        string
	DockerBuildTarget string
}

type Config

type Config struct {
	AppName         string                 `toml:"app,omitempty"`
	Build           *Build                 `toml:"build,omitempty"`
	PlatformVersion int                    `toml:"platform_version,omitempty"`
	PrimaryRegion   string                 `toml:"primary_region,omitempty"`
	HttpService     *HttpService           `toml:"http_service,omitempty"`
	VM              *VM                    `toml:"vm,omitempty"`
	Definition      map[string]interface{} `toml:"definition,omitempty"`
	Path            string                 `toml:"path,omitempty"`
}

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(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) 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) 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 []sourcecode.Static)

func (*Config) SetVolumes

func (c *Config) SetVolumes(volumes []sourcecode.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 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"`
}

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