setup

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package setup is a package which exposes the commands externally to the compiled binaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNetwork

GetNetwork will return a network from the configuration. This merges the information down to return the object, so it cannot be implemented in the networks package.

func GetService

GetService will return a service from the configuration. This merges the information down to return the object, so it cannot be implemented in the another package.

func GetServicesSorted

func GetServicesSorted(ctx context.Context, cli *client.Client, c *Config) []string

GetServicesSorted will return a list of services as plain text. due to some weirdness the ssh agent must be the first value.

func GetVolume

GetVolume will return a volume from the configuration. This merges the information down to return the object, so it cannot be implemented in the volumes package.

func ImportDefaults

func ImportDefaults(ctx context.Context, cli *client.Client, c *Config, service string, importer dockerruntime.Service) bool

ImportDefaults is an exported function which allows third-party applications to provide their own *Service and integrate it with their application so that Pygmy is more extendable via API. It's here so that we have one common import functionality that respects the users' decision to import config defaults in a centralized way.

func Setup

func Setup(ctx context.Context, cli *client.Client, c *Config)

Setup holds the core of configuration management with Pygmy. It will merge in all the configurations and provide defaults.

func Unique

func Unique(stringSlice []string) []string

Unique will return a slice with duplicates removed. It performs a similar function to the linux program `uniq`

Types

type CompatibilityCheck

type CompatibilityCheck struct {
	State   bool   `yaml:"value"`
	Message string `yaml:"string"`
}

CompatibilityCheck is a struct of fields associated to reporting of a result state.

func DryRun

func DryRun(ctx context.Context, cli *client.Client, c *Config) ([]CompatibilityCheck, error)

DryRun will check for. It is here to check for port compatibility before Pygmy attempts to start any containers and provide the user with a report.

type Config

type Config struct {
	// Keys are the paths to the Keys which should be added.
	Keys []Key `yaml:"keys"`

	// Domain is the default domain suffix to use.
	Domain string `yaml:"domain"`

	// TLSCertPath is the path to the TLS certificate to use with the Pygmy haproxy.
	TLSCertPath string `yaml:"tlsCertPath"`

	// Services is a []model.Service for an index of all Services.
	Services map[string]dockerruntime.Service `yaml:"services"`

	SortedServices []string

	// Networks is for network configuration
	Networks map[string]networktypes.Inspect `yaml:"networks"`

	// NoDefaults will prevent default configuration items.
	Defaults bool

	// JSONFormat indicates the `status` command should print to stdout in JSON format.
	JSONFormat bool

	// JSONStatus contains JSON status content.
	JSONStatus StatusJSON

	// ResolversDisabled will disable the creation of any resolv configurations.
	ResolversDisabled bool `yaml:"resolversDisabled"`

	// Resolvers is for all resolvers
	Resolvers []resolv.Resolv `yaml:"resolvers"`

	// Volumes will ensure names volumes are created
	Volumes map[string]volumetypes.Volume
}

Config is a struct of configurable options which can be passed to package library to configure logic for continued abstraction.

type Key

type Key struct {
	Path string `yaml:"path"`
}

Key is a struct with SSH key details.

type StatusJSON

type StatusJSON struct {
	PortAvailability []string                    `json:"port_availability"`
	Services         map[string]StatusJSONStatus `json:"service_status"`
	Networks         []string                    `json:"networks"`
	Resolvers        []string                    `json:"resolvers"`
	Volumes          []string                    `json:"volumes"`
	SSHMessages      []string                    `json:"ssh_messages"`
	URLValidations   []StatusJSONURLValidation   `json:"url_validations"`
}

type StatusJSONStatus

type StatusJSONStatus struct {
	Container string `json:"container"`
	ImageRef  string `json:"image"`
	State     bool   `json:"running"`
}

type StatusJSONURLValidation

type StatusJSONURLValidation struct {
	Endpoint string `json:"endpoint"`
	Success  bool   `json:"success"`
}

Jump to

Keyboard shortcuts

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