engine

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvironLocal     = `local`
	EnvironContainer = `container`
)
View Source
const (
	NgingConfigPrefix = `nging_`
)

Variables

View Source
var (
	ErrNotSetCertContainerDir          = errors.New(`CertContainerDir value is not set`)
	ErrNotSetCertLocalDir              = errors.New(`CertLocalDir value is not set`)
	ErrNotSetEngineConfigLocalFile     = errors.New(`EngineConfigLocalFile value is not set`)
	ErrNotSetEngineConfigContainerFile = errors.New(`EngineConfigContainerFile value is not set`)
	ErrNotSetVhostConfigLocalDir       = errors.New(`VhostConfigLocalDir value is not set`)
	ErrNotSetVhostConfigContainerDir   = errors.New(`VhostConfigContainerDir value is not set`)
)
View Source
var Engines = echo.NewKVData()
View Source
var Environs = echo.NewKVData().Add(EnvironLocal, `本机`).Add(EnvironContainer, `容器`)

Functions

func FixEngineConfigFile

func FixEngineConfigFile(cfg Configer, deleteMode ...bool) (bool, error)

func GetCtxStderr

func GetCtxStderr(c context.Context) io.Writer

func GetCtxStdout

func GetCtxStdout(c context.Context) io.Writer

func ParseContainerInfo

func ParseContainerInfo(parts []string) (string, string)

func RemoveCertFile

func RemoveCertFile(cfg Configer, id uint) error

func RemoveVhostConfigFile

func RemoveVhostConfigFile(cfg Configer, id uint) error

如果 id 为 0 代表删除此配置下的所有其它文件

func RenewalCert

func RenewalCert(cfg Configer, ctx context.Context, id uint, domains []string, email string) error

func Thirdparty

func Thirdparty() []echo.KV

func WithStderr

func WithStderr(c context.Context, w io.Writer) context.Context

func WithStdout

func WithStdout(c context.Context, w io.Writer) context.Context

func WithStdoutStderr

func WithStdoutStderr(c context.Context, w ...io.Writer) context.Context

Types

type APIClient

type APIClient struct {
	// contains filtered or unexported fields
}

func NewAPIClient

func NewAPIClient(certPEMBlock, keyPEMBlock []byte) (*APIClient, error)

NewAPIClient("cert.pem", "key.pem")

func (*APIClient) Post

func (a *APIClient) Post(url string, data interface{}) error

type CertFileRemover

type CertFileRemover interface {
	RemoveCertFile(id uint) error
}

type CertPathFormat

type CertPathFormat struct {
	Cert  string
	Key   string
	Trust string
}

type CertPathFormatGetter

type CertPathFormatGetter interface {
	GetCertPathFormat() CertPathFormat
}

type CertRenewaler

type CertRenewaler interface {
	RenewalCert(ctx context.Context, id uint, domains []string, email string) error
}

type CommonConfig

type CommonConfig struct {
	ID                        string
	Command                   string
	Endpoint                  string
	CmdWithConfig             bool
	WorkDir                   string
	EnvVars                   []string
	Environ                   string
	EngineConfigLocalFile     string
	EngineConfigContainerFile string
	VhostConfigLocalDir       string
	VhostConfigContainerDir   string
	CertLocalDir              string
	CertContainerDir          string
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(engineName, templateFile string) *CommonConfig

func (*CommonConfig) CopyFrom

func (c *CommonConfig) CopyFrom(m *dbschema.NgingVhostServer)

func (*CommonConfig) EngineConfigFile

func (c *CommonConfig) EngineConfigFile() string

func (*CommonConfig) Exec

func (c *CommonConfig) Exec(ctx context.Context, args ...string) ([]byte, error)

func (*CommonConfig) FixVhostDirPath

func (c *CommonConfig) FixVhostDirPath(vhostDir string) string

func (*CommonConfig) GetCertContainerDir

func (c *CommonConfig) GetCertContainerDir() string

func (*CommonConfig) GetCertLocalDir

func (c *CommonConfig) GetCertLocalDir() string

func (*CommonConfig) GetEngine

func (c *CommonConfig) GetEngine() string

func (*CommonConfig) GetEngineConfigContainerFile

func (c *CommonConfig) GetEngineConfigContainerFile() string

func (*CommonConfig) GetEngineConfigLocalFile

func (c *CommonConfig) GetEngineConfigLocalFile() string

func (*CommonConfig) GetEnviron

func (c *CommonConfig) GetEnviron() string

func (*CommonConfig) GetIdent

func (c *CommonConfig) GetIdent() string

func (*CommonConfig) GetTemplateFile

func (c *CommonConfig) GetTemplateFile() string

func (*CommonConfig) GetVhostConfigContainerDir

func (c *CommonConfig) GetVhostConfigContainerDir() string

func (*CommonConfig) GetVhostConfigLocalDir

func (c *CommonConfig) GetVhostConfigLocalDir() string

func (*CommonConfig) RemoveDir

func (c *CommonConfig) RemoveDir(typeName string, rootDir string, prefix string, extensions ...string) error

func (*CommonConfig) VhostConfigDir

func (c *CommonConfig) VhostConfigDir() string

type Configer

type Configer interface {
	GetVhostConfigLocalDirAbs() (string, error)
	GetTemplateFile() string
	GetIdent() string
	GetEngine() string
	GetEnviron() string
	GetCertLocalDir() string
	GetCertContainerDir() string
	GetVhostConfigLocalDir() string
	GetVhostConfigContainerDir() string
	GetEngineConfigLocalFile() string
	GetEngineConfigContainerFile() string
}

type ContextKey

type ContextKey string
const CtxKeyStderr ContextKey = `stderr`
const CtxKeyStdout ContextKey = `stdout`

type EngineConfigFileFixer

type EngineConfigFileFixer interface {
	FixEngineConfigFile(deleteMode ...bool) (bool, error)
}

type Enginer

type Enginer interface {
	Name() string
	ListConfig(ctx echo.Context) ([]Configer, error)
	BuildConfig(ctx echo.Context, m *dbschema.NgingVhostServer) Configer
	ReloadServer(ctx echo.Context, cfg Configer) error
	DefaultConfigDir() string
}

type ParsedCommand

type ParsedCommand struct {
	Command         string
	Args            []string
	ContainerEngine string
	ContainerName   string
}

type RequestDockerExec

type RequestDockerExec struct {
	AttachStdin  bool     `json:",omitempty"`
	AttachStdout bool     `json:",omitempty"`
	AttachStderr bool     `json:",omitempty"`
	DetachKeys   string   `json:",omitempty"` //"ctrl-p,ctrl-q",
	Tty          bool     `json:",omitempty"`
	Cmd          []string `json:",omitempty"` // ["date"],
	Env          []string `json:",omitempty"` // ["FOO=bar","BAZ=quux"]
}

documention: https://docs.docker.com/engine/api/v1.43/#tag/Exec/operation/ContainerExec API: /containers/{id}/exec

type VhostConfigRemover

type VhostConfigRemover interface {
	RemoveVhostConfig(id uint) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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