project

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProjectNameRegex = `^[a-zA-Z][a-zA-Z-_]+$`

	NotAFoldProject = errors.New("fold.yaml not found")
	InvalidConfig   = errors.New("invalid config file")
	CantWriteConfig = errors.New("can't write fold.yaml")
)
View Source
var (
	ServiceNameRegex = `^[a-z][a-z-_]+$`

	ServicePathInvalid = errors.New("cannot build an absolute path to the service")
)

Functions

func Home

func Home() (string, error)

func IsAFoldProject

func IsAFoldProject(path string) bool

Types

type ContainerAPI

type ContainerAPI interface {
	Context() context.Context
	NewNetwork(name string) *container.Network
	NetworkExists(net *container.Network) (bool, error)
	CreateNetwork(net *container.Network) error
	RemoveNetwork(net *container.Network) error
	GetImage(name string) (*container.Image, error)
	PullImage(name string) (*container.Image, error)
	BuildImage(img *container.Image) error
	NewContainer(
		name string,
		image container.Image,
		mounts ...container.Mount,
	) *container.Container
	GetContainer(name string) (*container.Container, error)
	RunContainer(net *container.Network, con *container.Container) error
	StopContainer(con *container.Container) error
}

type NotAService

type NotAService struct {
	Service string
}

func (NotAService) Error

func (nas NotAService) Error() string

type Project

type Project struct {
	Name       string
	Maintainer string
	Email      string
	Repository string
	Services   []*Service
	// contains filtered or unexported fields
}

func Load

func Load(logger logging.Logger, projectPath string) (*Project, error)

func (*Project) AddService

func (p *Project) AddService(svc Service)

func (*Project) ConfigureContainerAPI

func (p *Project) ConfigureContainerAPI(b ContainerAPI)

func (*Project) ConfigureGatewayPort

func (p *Project) ConfigureGatewayPort(port int)

func (*Project) ConfigureLogger

func (p *Project) ConfigureLogger(l logging.Logger)

func (*Project) Down

func (p *Project) Down() error

func (*Project) GetService

func (p *Project) GetService(path string) (*Service, error)

This works with either a path to a service or just a service name.

func (*Project) GetServices

func (p *Project) GetServices(paths ...string) ([]*Service, error)

func (*Project) NewService

func (p *Project) NewService(name string) *Service

func (*Project) SaveConfig

func (p *Project) SaveConfig(projectPath string) error

func (*Project) Up

func (p *Project) Up(ctx context.Context, out io.Writer, services ...*Service) error

func (*Project) Validate added in v0.1.2

func (p *Project) Validate() error

type Service

type Service struct {
	Name   string
	Path   string
	Mounts []string
	Port   int
	// contains filtered or unexported fields
}

func (*Service) AbsPath

func (s *Service) AbsPath() (string, error)

func (*Service) Build

func (s *Service) Build(ctx context.Context, out io.Writer) (*container.Image, error)

func (*Service) Id

func (s *Service) Id() string

func (*Service) Start

func (s *Service) Start(img *container.Image, net *container.Network) error

func (*Service) Stop

func (s *Service) Stop() error

func (*Service) Validate

func (s *Service) Validate() error

Jump to

Keyboard shortcuts

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