sitefile

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sitefile reads site files. A site file declares a site: a named group of chargers that are started and stopped together.

Index

Constants

View Source
const DefaultName = "site.yaml"

DefaultName is the site file looked for when none is named.

Variables

This section is empty.

Functions

func CheckUploadHost added in v0.1.4

func CheckUploadHost(host string) error

CheckUploadHost reports what is wrong with a host that diagnostics are to be allowed to go to. It is a host name or an address, as a location names it: no scheme, port or path.

func Name

func Name(path string) (string, error)

Name returns the name of the site that the file at path declares, without checking the rest of the file. Shutting a site down needs only its name, and must still work when the file has since been edited into something invalid.

Types

type Charger

type Charger struct {
	// ID is the charge point ID.
	ID string
	// Name is the name the file gives the charger, or empty to have one
	// made up.
	Name string
	// Model is the charger's model, with the entry's configuration
	// overrides applied.
	Model *model.Model
	CSMS  charger.CSMS
	// EV names the EV preset used when a plug does not name one, or is
	// empty.
	EV string
}

Charger is one charger the site will run.

type Entry

type Entry struct {
	// Name is the entry's name. It is used only inside the file.
	Name     string
	Chargers []Charger
}

Entry is one entry under "chargers": a model instantiated one or more times.

type Site

type Site struct {
	Name string
	// Path is the absolute path of the site file.
	Path string
	// Speed multiplies the rate of EV charging. It is 1 unless the file
	// says otherwise.
	Speed float64
	// ConnectRate is the most new connections to open per second. Zero
	// means no limit: every charger connects at once.
	ConnectRate float64
	// LogMaxSize and LogFiles cap the site's log: at most LogFiles files of
	// LogMaxSize bytes. Zero stands for the defaults, 10 MB and 3.
	LogMaxSize int64
	LogFiles   int
	// AllowUploads lists the hosts diagnostics may be uploaded to besides
	// the machine the CSMS is on.
	AllowUploads []string
	// UploadsInsecureSkipVerify turns off the check of the certificate of
	// an https or ftps server diagnostics are uploaded to.
	UploadsInsecureSkipVerify bool
	// EVs holds the EV presets by name.
	EVs map[string]ev.Overrides
	// Entries are the charger entries, in the order the file lists them.
	Entries []Entry
}

Site is a site as declared by one site file.

func Load

func Load(path string) (*Site, error)

Load reads and validates the site file at path, together with the Chargerfiles it refers to.

func Parse

func Parse(data []byte, baseDir string, lookupEnv func(string) (string, bool)) (*Site, error)

Parse reads and validates the contents of a site file. Chargerfile paths are taken relative to baseDir, and ${VAR} references are resolved with lookupEnv. When the file has several problems, the returned error lists all of them.

func (*Site) Chargers

func (s *Site) Chargers() []Charger

Chargers returns every charger of the site, in file order.

Jump to

Keyboard shortcuts

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