service

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Title               string            `json:"title,omitempty"`
	Name                string            `json:"name"`
	Desc                string            `json:"desc,omitempty"`
	URL                 string            `json:"url,omitempty"`
	ReverseDNS          string            `json:"reverse_dns"`           // i.e. com.example.foo-app
	Interpreter         string            `json:"interpreter,omitempty"` // i.e. node, python
	Exec                string            `json:"exec"`
	Argv                []string          `json:"argv,omitempty"`
	Workdir             string            `json:"workdir,omitempty"`
	Envs                map[string]string `json:"envs,omitempty"`
	User                string            `json:"user,omitempty"`
	Group               string            `json:"group,omitempty"`
	Home                string            `json:"-"`
	Local               string            `json:"-"`
	Logdir              string            `json:"logdir"`
	System              bool              `json:"system"`
	Restart             bool              `json:"restart"`
	Production          bool              `json:"production,omitempty"`
	PrivilegedPorts     bool              `json:"privileged_ports,omitempty"`
	MultiuserProtection bool              `json:"multiuser_protection,omitempty"`
}

Service should describe the service well-enough for it to run on Mac, Linux, and Windows.

&Service{
	// A human-friendy name
	Title: "Foobar App",
	// A computer-friendly name
	Name: "foobar-app",
	// A name for OS X plist
	ReverseDNS: "com.example.foobar-app",
	// A human-friendly description
	Desc: "Foobar App",
	// The app /service homepage
	URL: "https://example.com/foobar-app/",
	// The full path of the interpreter, if any (ruby, python, node, etc)
	Interpreter: "/opt/node/bin/node",
	// The name of the executable (or script)
	Exec: "foobar-app.js",
	// An array of arguments
	Argv: []string{"-c", "/path/to/config.json"},
	// A map of Environment variables that should be set
	Envs: map[string]string{
		PORT: "8080",
		ENV: "development",
	},
	// The user (Linux & Mac only).
	// This does not apply to userspace services.
	// There may be special considerations
	User: "www-data",
	// If different from User
	Group: "",
	// Whether to install as a system or user service
	System: false,
	// Whether or not the service may need privileged ports
	PrivilegedPorts: false,
}

Note that some fields are exported for templating, but not intended to be set by you. These are documented as omitted from JSON. Try to stick to what's outlined above.

func (*Service) Normalize

func (s *Service) Normalize(force bool)

func (*Service) NormalizeWithoutPath

func (s *Service) NormalizeWithoutPath()

Jump to

Keyboard shortcuts

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