Documentation
¶
Overview ¶
Package app implements functionality related to reading and writing app configuration files.
Index ¶
- Constants
- func ConfigFileExistsAtPath(p string) (bool, error)
- func NameFromContext(ctx context.Context) string
- func ResolveConfigFileFromPath(p string) (string, error)
- func WithConfig(ctx context.Context, cfg *Config) context.Context
- func WithName(ctx context.Context, name string) context.Context
- type Build
- type Config
- func ConfigFromContext(ctx context.Context) *Config
- func FromAppAndMachineSet(ctx context.Context, appCompact *api.AppCompact, machines machine.MachineSet) (*Config, string, error)
- func FromDefinition(definition *api.Definition) (*Config, error)
- func LoadConfig(path string) (cfg *Config, err error)
- func NewConfig() *Config
- func (c *Config) DockerBuildTarget() string
- func (c *Config) Dockerfile() string
- func (c *Config) GetProcessConfigs() (map[string]*ProcessConfig, error)
- func (c *Config) HasNonHttpAndHttpsStandardServices() bool
- func (c *Config) HasUdpService() bool
- func (c *Config) Ignorefile() string
- func (c *Config) SetConcurrency(soft int, hard int) bool
- 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) SetHttpCheck(path string) bool
- func (c *Config) SetInternalPort(port int) bool
- func (c *Config) SetKillSignal(signal string)
- func (c *Config) SetProcess(name, value string)
- func (c *Config) SetReleaseCommand(cmd string)
- func (c *Config) SetStatics(statics []Static)
- func (c *Config) SetVolumes(volumes []Volume)
- func (c *Config) ToDefinition() (*api.Definition, error)
- 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 Experimental
- type HTTPService
- type ProcessConfig
- type Service
- type ServiceHTTPCheck
- type ServiceTCPCheck
- type Static
- type ToplevelCheck
- type VM
- type Volume
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 AppsV1Platform = "nomad" AppsV2Platform = "machines" )
Variables ¶
This section is empty.
Functions ¶
func ConfigFileExistsAtPath ¶
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" json:"builder,omitempty"`
Args map[string]string `toml:"args,omitempty" json:"args,omitempty"`
Buildpacks []string `toml:"buildpacks,omitempty" json:"buildpacks,omitempty"`
Image string `toml:"image,omitempty" json:"image,omitempty"`
Settings map[string]any `toml:"settings,omitempty" json:"settings,omitempty"`
Builtin string `toml:"builtin,omitempty" json:"builtin,omitempty"`
Dockerfile string `toml:"dockerfile,omitempty" json:"dockerfile,omitempty"`
Ignorefile string `toml:"ignorefile,omitempty" json:"ignorefile,omitempty"`
DockerBuildTarget string `toml:"build-target,omitempty" json:"build-target,omitempty"`
}
type Config ¶
type Config struct {
AppName string `toml:"app,omitempty" json:"app,omitempty"`
KillSignal string `toml:"kill_signal,omitempty" json:"kill_signal,omitempty"`
KillTimeout int `toml:"kill_timeout,omitempty" json:"kill_timeout,omitempty"`
PrimaryRegion string `toml:"primary_region,omitempty" json:"primary_region,omitempty"`
Experimental *Experimental `toml:"experimental,omitempty" json:"experimental,omitempty"`
Build *Build `toml:"build,omitempty" json:"build,omitempty"`
Deploy *Deploy `toml:"deploy, omitempty" json:"deploy,omitempty"`
Env map[string]string `toml:"env,omitempty" json:"env,omitempty"`
HttpService *HTTPService `toml:"http_service,omitempty" json:"http_service,omitempty"`
Metrics *api.MachineMetrics `toml:"metrics,omitempty" json:"metrics,omitempty"`
Statics []Static `toml:"statics,omitempty" json:"statics,omitempty"`
Mounts *Volume `toml:"mounts,omitempty" json:"mounts,omitempty"`
Processes map[string]string `toml:"processes,omitempty" json:"processes,omitempty"`
Checks map[string]*ToplevelCheck `toml:"checks,omitempty" json:"checks,omitempty"`
Services []Service `toml:"services,omitempty" json:"services,omitempty"`
// TODO: Move this to private attr
FlyTomlPath string `toml:"-" json:"-"`
}
Config wraps the properties of app configuration. NOTE: If you any new setting here, please also add a value for it at testdata/rull-reference.toml
func ConfigFromContext ¶
ConfigFromContext returns the Config ctx carries.
func FromAppAndMachineSet ¶ added in v0.0.465
func FromAppAndMachineSet(ctx context.Context, appCompact *api.AppCompact, machines machine.MachineSet) (*Config, string, error)
func FromDefinition ¶
func FromDefinition(definition *api.Definition) (*Config, error)
func LoadConfig ¶
LoadConfig loads the app config at the given path.
func (*Config) DockerBuildTarget ¶
func (*Config) Dockerfile ¶
func (*Config) GetProcessConfigs ¶
func (c *Config) GetProcessConfigs() (map[string]*ProcessConfig, error)
func (*Config) HasNonHttpAndHttpsStandardServices ¶
func (*Config) HasUdpService ¶
func (*Config) Ignorefile ¶
func (*Config) SetDockerCommand ¶
func (*Config) SetDockerEntrypoint ¶
func (*Config) SetEnvVariable ¶
func (*Config) SetEnvVariables ¶
func (*Config) SetHttpCheck ¶
func (*Config) SetInternalPort ¶
func (*Config) SetKillSignal ¶
func (*Config) SetProcess ¶
func (*Config) SetReleaseCommand ¶
func (*Config) SetStatics ¶
func (*Config) SetVolumes ¶
func (*Config) ToDefinition ¶
func (c *Config) ToDefinition() (*api.Definition, error)
func (*Config) WriteToDisk ¶
func (*Config) WriteToFile ¶
type Experimental ¶
type Experimental struct {
Cmd []string `toml:"cmd,omitempty" json:"cmd,omitempty"`
Entrypoint []string `toml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
Exec []string `toml:"exec,omitempty" json:"exec,omitempty"`
AutoRollback bool `toml:"auto_rollback,omitempty" json:"auto_rollback,omitempty"`
EnableConsul bool `toml:"enable_consul,omitempty" json:"enable_consul,omitempty"`
EnableEtcd bool `toml:"enable_etcd,omitempty" json:"enable_etcd,omitempty"`
}
type HTTPService ¶
type HTTPService struct {
InternalPort int `json:"internal_port,omitempty" toml:"internal_port" validate:"required,numeric"`
ForceHttps bool `toml:"force_https" json:"force_https,omitempty"`
Concurrency *api.MachineServiceConcurrency `toml:"concurrency,omitempty" json:"concurrency,omitempty"`
}
type ProcessConfig ¶
type ProcessConfig struct {
Cmd []string
Services []api.MachineService
Checks map[string]api.MachineCheck
}
type Service ¶
type Service struct {
Protocol string `json:"protocol,omitempty" toml:"protocol"`
InternalPort int `json:"internal_port,omitempty" toml:"internal_port"`
Ports []api.MachinePort `json:"ports,omitempty" 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 ¶
type ServiceHTTPCheck struct {
Interval *api.Duration `json:"interval,omitempty" toml:"interval,omitempty"`
Timeout *api.Duration `json:"timeout,omitempty" toml:"timeout,omitempty"`
// GracePeriod and RestartLimit are only supported on V1 Apps
GracePeriod *api.Duration `toml:"grace_period,omitempty" json:"grace_period,omitempty"`
RestartLimit int `toml:"restart_limit,omitempty" json:"restart_limit,omitempty"`
// HTTP Specifics
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 ¶
func (chk *ServiceHTTPCheck) String(port int) string
type ServiceTCPCheck ¶
type ServiceTCPCheck struct {
Interval *api.Duration `json:"interval,omitempty" toml:"interval,omitempty"`
Timeout *api.Duration `json:"timeout,omitempty" toml:"timeout,omitempty"`
// GracePeriod and RestartLimit are only supported on V1 Apps
GracePeriod *api.Duration `toml:"grace_period,omitempty" json:"grace_period,omitempty"`
RestartLimit int `toml:"restart_limit,omitempty" json:"restart_limit,omitempty"`
}
func (*ServiceTCPCheck) String ¶
func (chk *ServiceTCPCheck) String(port int) string
type ToplevelCheck ¶
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"`
GracePeriod *api.Duration `json:"grace_period,omitempty" toml:"grace_period,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 ¶
func (chk *ToplevelCheck) String() string
Click to show internal directories.
Click to hide internal directories.