Documentation
¶
Index ¶
- type Environment
- func (e *Environment) CheckImages() error
- func (e *Environment) Cleanup()
- func (e *Environment) Execute() error
- func (e *Environment) GetContainers() ([]types.Container, error)
- func (e *Environment) GetNetwork() (string, error)
- func (e *Environment) HealthCheck(ctx context.Context) error
- func (e *Environment) Init() error
- func (e *Environment) Prepare() error
- func (e *Environment) PrepareNetwork() error
- func (e *Environment) PruneContainers() error
- func (e *Environment) PruneNetworks() error
- func (e *Environment) RemoveNetwork() error
- func (e *Environment) Seed(path string) error
- func (e *Environment) Shutdown(purge bool, ctx context.Context) error
- func (e *Environment) UpdateState(state State)
- func (e *Environment) WrapContainersAsServices(containers []types.Container) error
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Environment ¶
type Environment struct {
sync.Mutex
// Records the current state of the environment
State State
// List of all HTTP servers registered with our environment.
Servers []*http.Server
// Parent cancellable context
Context context.Context
Cancel context.CancelFunc
// Execution specific cancellable context
ExecutionContext context.Context
ExecutionCancel context.CancelFunc
Port string
Hasura *hasura.Client
Docker *client.Client
Config nhost.Configuration
Network string
Watcher *watcher.Watcher
}
func (*Environment) CheckImages ¶
func (e *Environment) CheckImages() error
Prepare func validates whether all required images exist, and downloads any one which doesn't.
func (*Environment) Cleanup ¶
func (e *Environment) Cleanup()
func (*Environment) GetContainers ¶
func (e *Environment) GetContainers() ([]types.Container, error)
returns the list of running containers whose names have specified prefix
func (*Environment) GetNetwork ¶
func (e *Environment) GetNetwork() (string, error)
fetches ID of docker network by name
func (*Environment) HealthCheck ¶
func (e *Environment) HealthCheck(ctx context.Context) error
Runs concurrent healthchecks on all Nhost services, which have a health check endpoint.
Also, supports process cancellation from contexts.
func (*Environment) Init ¶
func (e *Environment) Init() error
func (*Environment) Prepare ¶
func (e *Environment) Prepare() error
func (*Environment) PrepareNetwork ¶
func (e *Environment) PrepareNetwork() error
If docker network exists -> fetches it's ID If it doesn't exist -> creates a new network
func (*Environment) PruneContainers ¶
func (e *Environment) PruneContainers() error
prune unused containers
func (*Environment) PruneNetworks ¶
func (e *Environment) PruneNetworks() error
prune unused networks
func (*Environment) RemoveNetwork ¶
func (e *Environment) RemoveNetwork() error
removes a given network by ID
func (*Environment) Seed ¶
func (e *Environment) Seed(path string) error
func (*Environment) Shutdown ¶
func (e *Environment) Shutdown(purge bool, ctx context.Context) error
Stops, and additionally, removes all Nhost containers
func (*Environment) UpdateState ¶
func (e *Environment) UpdateState(state State)
func (*Environment) WrapContainersAsServices ¶
func (e *Environment) WrapContainersAsServices(containers []types.Container) error
Wraps a list of docker containers as *nhost.Services for respective environment.