configuration

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package configuration configures credentials for accessing the SunSynk API.

Index

Constants

View Source
const DefaultEndpoint = "https://api.sunsynk.net"

DefaultEndpoint is SunSynk's region 1 endpoint.

Variables

This section is empty.

Functions

func DefaultConfigurationFile added in v0.15.0

func DefaultConfigurationFile() (string, error)

DefaultConfigurationFile gets the path to the default location of the synk config file ($HOME/.synk/config on Linux).

func WriteConfigurationToFile

func WriteConfigurationToFile(fileName string, configuration *Configuration) error

WriteConfigurationToFile writes a marshalled configuration object to a YAML file

Types

type Configuration

type Configuration struct {
	Endpoint          string `yaml:"endpoint"`
	User              string `yaml:"user"`
	Password          string `yaml:"password"`
	DefaultInverterSN string `yaml:"default_inverter_sn,omitempty"`
}

Configuration stores the credentials to access the SunSynk API

func New

func New(user string, password string) (*Configuration, error)

New constructs a configuration object with a specified username/password combination using the default region 1 (London) endpoint

func NewWithEndpoint

func NewWithEndpoint(user string, password string, endpoint string) (*Configuration, error)

NewWithEndpoint constructs a configuration object with username/password credentials and an overridden API endpoint

func ReadConfigurationFromFile

func ReadConfigurationFromFile(fileName string) (*Configuration, error)

ReadConfigurationFromFile unnmarshals a configuration object from a YAML file

Jump to

Keyboard shortcuts

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