Documentation
¶
Overview ¶
Package app implements functionality related to reading and writing app configuration files.
Index ¶
- Constants
- func NameFromContext(ctx context.Context) string
- func WithConfig(ctx context.Context, cfg *Config) context.Context
- func WithName(ctx context.Context, name string) context.Context
- type Build
- type Check
- type Config
- func (c *Config) DeterminePlatform(ctx context.Context, r io.ReadSeeker) (err error)
- func (c *Config) DockerBuildTarget() string
- func (c *Config) Dockerfile() string
- func (c *Config) EncodeTo(w io.Writer) error
- func (c *Config) ForMachines() bool
- func (c *Config) GetDeployStrategy() string
- func (c *Config) GetEnvVariables() map[string]string
- func (ac *Config) HasBuilder() bool
- func (ac *Config) HasBuiltin() bool
- func (c *Config) HasDefinition() bool
- func (c *Config) HasServices() bool
- func (c *Config) Ignorefile() string
- func (ac *Config) Image() string
- func (c *Config) InternalPort() (int, error)
- func (c *Config) SetDockerCommand(cmd string)
- func (c *Config) SetDockerEntrypoint(entrypoint string)
- func (c *Config) SetEnvVariable(name, value string)
- func (c *Config) SetEnvVariables(vals map[string]string)
- func (c *Config) SetInternalPort(port int) bool
- func (c *Config) SetKillSignal(signal string)
- func (c *Config) SetMachinesPlatform()
- func (c *Config) SetNomadPlatform()
- func (c *Config) SetPlatformVersion(platform string)
- func (c *Config) SetProcess(name, value string)
- func (c *Config) SetReleaseCommand(cmd string)
- func (c *Config) SetStatics(statics []scanner.Static)
- func (c *Config) SetVolumes(volumes []scanner.Volume)
- func (c *Config) Validate() (err error)
- func (c *Config) WriteToDisk(ctx context.Context, path string) (err error)
- func (c *Config) WriteToFile(filename string) (err error)
- type Deploy
- type HttpCheck
- type HttpService
- type Service
- type SlimConfig
- type Static
- type TcpCheck
- type VM
Constants ¶
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 ¶
NameFromContext returns the app name ctx carries or an empty string.
func WithConfig ¶
WithConfig derives a context that carries cfg 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"`
Ignorefile string `toml:"ignorefile,omitempty"`
DockerBuildTarget string `toml:"buildpacks,omitempty"`
}
type Check ¶
type Check struct {
Type string `json:"type,omitempty" toml:"type,omitempty"`
Port int `json:"port,omitempty" toml:"port,omitempty"`
Interval *api.Duration `json:"interval,omitempty" toml:"interval,omitempty"`
Timeout *api.Duration `json:"timeout,omitempty" toml:"timeout,omitempty"`
GracePeriod *api.Duration `json:"grace_period,omitempty" toml:"grace_period,omitempty"`
RestartLimit int `json:"restart_limit,omitempty" toml:"restart_limit,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"`
TLSSkipVerify bool `json:"tls_skip_verify,omitempty" toml:"tls_skip_verify,omitempty"`
Headers map[string]string `json:"headers,omitempty" toml:"headers,omitempty"`
}
func (*Check) ToMachineCheck ¶
func (c *Check) ToMachineCheck() (*api.MachineCheck, error)
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 []Service `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]*Check `toml:"checks,omitempty"`
Mounts *scanner.Volume `toml:"mounts,omitempty"`
// contains filtered or unexported fields
}
Config wraps the properties of app configuration.
func ConfigFromContext ¶
ConfigFromContext returns the Config ctx carries.
func LoadConfig ¶
LoadConfig loads the app config at the given path.
func (*Config) DeterminePlatform ¶ added in v0.0.343
func (*Config) DockerBuildTarget ¶
func (*Config) Dockerfile ¶
func (*Config) ForMachines ¶ added in v0.0.343
ForMachines is true when the config is intended for the machines platform
func (*Config) GetDeployStrategy ¶
func (*Config) GetEnvVariables ¶ added in v0.0.335
func (*Config) HasBuilder ¶
func (*Config) HasBuiltin ¶
func (*Config) HasDefinition ¶
func (*Config) HasServices ¶
HasServices - Does this config have a services section
func (*Config) Ignorefile ¶ added in v0.0.433
func (*Config) InternalPort ¶
func (*Config) SetDockerCommand ¶
func (*Config) SetDockerEntrypoint ¶
func (*Config) SetEnvVariable ¶
func (*Config) SetEnvVariables ¶
func (*Config) SetInternalPort ¶
func (*Config) SetKillSignal ¶
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 (*Config) SetProcess ¶
func (*Config) SetReleaseCommand ¶
func (*Config) SetStatics ¶
func (*Config) SetVolumes ¶
func (*Config) WriteToDisk ¶ added in v0.0.335
func (*Config) WriteToFile ¶
type Deploy ¶ added in v0.0.361
type Deploy struct {
ReleaseCommand string `toml:"release_command,omitempty"`
}
type HttpCheck ¶
type HttpCheck struct {
Interval *api.Duration `json:"interval,omitempty" toml:"interval,omitempty"`
Timeout *api.Duration `json:"timeout,omitempty" toml:"timeout,omitempty"`
GracePeriod *api.Duration `json:"grace_period,omitempty" toml:"grace_period,omitempty"`
RestartLimit int `json:"restart_limit,omitempty" toml:"restart_limit,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"`
TLSSkipVerify bool `json:"tls_skip_verify,omitempty" toml:"tls_skip_verify,omitempty"`
Headers map[string]string `json:"headers,omitempty" toml:"headers,omitempty"`
}
func (*HttpCheck) ToMachineCheck ¶
func (hc *HttpCheck) ToMachineCheck(port int) (*api.MachineCheck, 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"`
Concurrency *api.MachineServiceConcurrency `toml:"concurrency,omitempty"`
}
func (*HttpService) ToMachineService ¶
func (hs *HttpService) ToMachineService() *api.MachineService
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 []*TcpCheck `json:"tcp_checks,omitempty" toml:"tcp_checks,omitempty"`
HttpChecks []*HttpCheck `json:"http_checks,omitempty" toml:"http_checks,omitempty"`
}
func (*Service) ToMachineService ¶
func (s *Service) ToMachineService() *api.MachineService
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 TcpCheck ¶
type TcpCheck struct {
Interval *api.Duration `json:"interval,omitempty" toml:"interval,omitempty"`
Timeout *api.Duration `json:"timeout,omitempty" toml:"timeout,omitempty"`
GracePeriod *api.Duration `json:"grace_period,omitempty" toml:"grace_period,omitempty"`
RestartLimit int `json:"restart_limit,omitempty" toml:"restart_limit,omitempty"`
}
func (*TcpCheck) ToMachineCheck ¶
func (tc *TcpCheck) ToMachineCheck(port int) (*api.MachineCheck, error)