service

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigValueNull   = 0
	ConfigValueString = iota
	ConfigValueTrue
	ConfigValueFalse
)
View Source
const ConfigName = "conductor-service.json"

Variables

Functions

func ServiceConfigUnit

func ServiceConfigUnit(path string) string

func ServiceDirByName

func ServiceDirByName(name string) (string, error)

func ServiceDirFromUnit

func ServiceDirFromUnit(u string) string

func ServiceFileByName

func ServiceFileByName(name string) (string, error)

func ServiceNameFromFile

func ServiceNameFromFile(service_file string) (string, error)

func ServiceRealpath

func ServiceRealpath(service_dir string) (string, error)

func ServiceUnit

func ServiceUnit(path string) string

func ServiceUnitByName

func ServiceUnitByName(name string) (string, error)

Types

type CaddyConfig

type CaddyConfig struct {
	ApiEndpoint string `json:"api_endpoint"`
}

type ConfigValue added in v0.0.24

type ConfigValue struct {
	Kind ConfigValueKind
	Str  string
}

func (*ConfigValue) MarshalJSON added in v0.0.24

func (v *ConfigValue) MarshalJSON() ([]byte, error)

func (*ConfigValue) String added in v0.0.24

func (v *ConfigValue) String() string

func (*ConfigValue) UnmarshalJSON added in v0.0.24

func (v *ConfigValue) UnmarshalJSON(data []byte) error

type ConfigValueKind added in v0.0.24

type ConfigValueKind int

type HelpFlag added in v0.0.15

type HelpFlag struct {
	Name string
	Help string
}

type Hook

type Hook struct {
	Id         string   `json:"id"`
	When       string   `json:"when"`
	Exec       []string `json:"exec"`
	TimeoutSec int64    `json:"timeout_sec"`
}

type InheritFile added in v0.0.15

type InheritFile struct {
	InheritFileBase
	Inherit *InheritedFile
}

func (*InheritFile) UnmarshalJSON added in v0.0.15

func (f *InheritFile) UnmarshalJSON(data []byte) error

type InheritFileBase added in v0.0.15

type InheritFileBase struct {
	Path        string `json:"path"`
	IgnoreError bool   `json:"ignore_error"`
	SetConfig   bool   `json:"set_config"`
}

type InheritedFile added in v0.0.15

type InheritedFile struct {
	Inherit []*InheritFile `json:"inherit"`
}

func DecodeInherit added in v0.0.15

func DecodeInherit(data []byte, dir string) (*InheritedFile, error)

type InheritedFileSingle added in v0.0.15

type InheritedFileSingle struct {
	Inherit *InheritFile `json:"inherit"`
}

type Service

type Service struct {
	BasePath                string                     `json:"-"`
	FileName                string                     `json:"-"`
	ConfigSetFile           string                     `json:"-"`
	Name                    string                     `json:"-"`
	Id                      string                     `json:"-"`
	Inherit                 *InheritedFile             `json:"-"`
	AppName                 string                     `json:"app_name,omitempty"`              // my-app
	InstanceName            string                     `json:"instance_name,omitempty"`         // staging
	Config                  map[string]*ConfigValue    `json:"config,omitempty"`                // key-value pairs for config and templating, CHANNEL=staging
	ProxyConfigTemplate     string                     `json:"proxy_config_template,omitempty"` // Template file for the load-balancer config
	Pods                    ServicePods                `json:"pods,omitempty"`
	Functions               ServiceFunctions           `json:"functions,omitempty"`
	Hooks                   []*Hook                    `json:"hooks,omitempty"`
	CaddyLoadBalancer       CaddyConfig                `json:"caddy_load_balancer"`
	DisplayServiceConfig    []string                   `json:"display_service_config"`
	DisplayDeploymentConfig []string                   `json:"display_deployment_config"`
	Commands                map[string]*ServiceCommand `json:"commands"`
}

func LoadServiceByName

func LoadServiceByName(name string) (*Service, error)

func LoadServiceDir

func LoadServiceDir(dir string) (*Service, error)

func LoadServiceFile

func LoadServiceFile(path string) (*Service, error)

func (*Service) ComputeId

func (service *Service) ComputeId(extra string) (string, error)

func (*Service) FillDefaults

func (service *Service) FillDefaults() error

func (*Service) Parts added in v0.0.20

func (service *Service) Parts() ([]string, error)

func (*Service) UnitStatus added in v0.0.15

func (service *Service) UnitStatus(ctx context.Context) (dbus.UnitStatus, error)

func (*Service) Vars

func (service *Service) Vars() []string

type ServiceCommand added in v0.0.15

type ServiceCommand struct {
	Deployment           bool       `json:"deployment"`
	Service              bool       `json:"service"`
	ServiceAnyDeployment bool       `json:"service_any_deployment"`
	Description          string     `json:"description"`
	Exec                 []string   `json:"exec"`
	HelpFlags            [][]string `json:"help_flags"`
	HelpArgs             []string   `json:"help_args"`
}

func (*ServiceCommand) GetHelpFlags added in v0.0.15

func (c *ServiceCommand) GetHelpFlags() []HelpFlag

func (*ServiceCommand) GetTabbedHelpFlags added in v0.0.15

func (c *ServiceCommand) GetTabbedHelpFlags() *utils.Tabbed

type ServiceFunction added in v0.0.29

type ServiceFunction struct {
	Name              string   `json:"name"`
	Format            string   `json:"format,omitempty"` // Format: cgi, http-stdio
	Exec              []string `json:"exec,omitempty"`
	StderrAsStdout    bool     `json:"stderr_as_stdout,omitempty"`
	ResponseHeaders   []string `json:"response_headers,omitempty"`    // Additional response headers
	NoResponseHeaders bool     `json:"no_response_headers,omitempty"` // Function does not add response headers
	PathInfoStrip     int      `json:"path_info_strip,omitempty"`     // Strip this number of leading elements from PATH_INFO
	Policies          []string `json:"policies,omitempty"`            // Policies to match
}

type ServiceFunctions added in v0.0.29

type ServiceFunctions []*ServiceFunction

func (*ServiceFunctions) FillDefaults added in v0.0.29

func (functions *ServiceFunctions) FillDefaults(service *Service)

func (*ServiceFunctions) FindFunction added in v0.0.29

func (functions *ServiceFunctions) FindFunction(name string) *ServiceFunction

func (*ServiceFunctions) FindMainFunction added in v0.0.29

func (functions *ServiceFunctions) FindMainFunction() *ServiceFunction

func (*ServiceFunctions) FixPaths added in v0.0.29

func (functions *ServiceFunctions) FixPaths(dir string) error

func (*ServiceFunctions) UnmarshalJSON added in v0.0.29

func (functions *ServiceFunctions) UnmarshalJSON(data []byte) error

type ServicePod added in v0.0.20

type ServicePod struct {
	Name              string `json:"name"`
	PodTemplate       string `json:"pod_template,omitempty"`        // Template file for pod
	ConfigMapTemplate string `json:"config_map_template,omitempty"` // ConfigMap template file
}

type ServicePods added in v0.0.20

type ServicePods []*ServicePod

func (*ServicePods) FillDefaults added in v0.0.20

func (pods *ServicePods) FillDefaults(service *Service)

func (*ServicePods) FindMainPod added in v0.0.20

func (pods *ServicePods) FindMainPod() *ServicePod

func (*ServicePods) FindPod added in v0.0.20

func (pods *ServicePods) FindPod(name string) *ServicePod

func (*ServicePods) FixPaths added in v0.0.20

func (pods *ServicePods) FixPaths(dir string) error

func (*ServicePods) UnmarshalJSON added in v0.0.20

func (pods *ServicePods) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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