server

package
v0.0.0-...-93e21f3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: BSD-3-Clause Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExecutorCount  = 1
	DefaultImageStorage   = "filesystem"
	DefaultImageStateDir  = "/var/lib/gate/image"
	DefaultDatabaseDriver = "sqlite"
	DefaultInventoryDSN   = "file:/var/lib/gate/inventory/inventory.sqlite?cache=shared"
	DefaultSourceCacheDSN = "file:/var/cache/gate/source/source.sqlite?cache=shared"
	DefaultNet            = "tcp"
	DefaultHTTPAddr       = "localhost:8080"
	DefaultACMECacheDir   = "/var/cache/gate/acme"
)
View Source
const DefaultServerName = "gate"

Variables

View Source
var DefaultConfigFiles = []string{
	"/etc/gate/server.toml",
	"/etc/gate/server.d/*.toml",
}

Functions

func Main

func Main()

Main will not return.

func Router

func Router() router.Router

Router can be used to register additional URLs to serve via HTTP.

func SetHandlerFunc

func SetHandlerFunc(f func(w http.ResponseWriter, r *http.Request, next http.Handler))

SetHandlerFunc replaces the function which is invoked for every HTTP request. The registered function should call the next handler's ServeHTTP method to pass the control to the server.

This function has no effect if called after during Main.

Types

type Config

type Config struct {
	Runtime struct {
		runtime.Config
		PrepareProcesses int
		ExecutorCount    int
	}

	Image struct {
		ProgramStorage   string
		PreparePrograms  int
		InstanceStorage  string
		PrepareInstances int
		StateDir         string
	}

	Inventory map[string]database.Config

	Service map[string]any

	Server struct {
		server.Config

		UID int
		GID int
	}

	Access struct {
		Policy string

		Public struct{}

		SSH struct {
			AuthorizedKeys string
		}
	}

	Principal server.AccessConfig

	Source struct {
		Cache map[string]database.Config

		HTTP []struct {
			Name string
			httpsource.Config
		}

		IPFS struct {
			ipfs.Config
		}
	}

	HTTP struct {
		Net  string
		Addr string
		webserver.Config
		AccessDB  map[string]database.Config
		AccessLog string

		TLS struct {
			Enabled  bool
			Domains  []string
			HTTPNet  string
			HTTPAddr string
		}
	}

	ACME struct {
		AcceptTOS    bool
		CacheDir     string
		RenewBefore  time.Duration
		DirectoryURL string
		Email        string
		ForceRSA     bool
	}

	Log struct {
		Journal bool
	}
}

Jump to

Keyboard shortcuts

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