config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 8 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 config merges eightsleep's settings: root flags, then EIGHTSLEEP_ and EIGHTCTL_ environment variables, then the YAML config file, the precedence eightctl's viper setup had.

Index

Constants

This section is empty.

Variables

View Source
var Prefixes = []string{"EIGHTSLEEP_", "EIGHTCTL_"}

Prefixes are the environment variable prefixes, most preferred first. EIGHTCTL_ is the name every existing setup uses.

Functions

func DefaultPath

func DefaultPath(home string) string

DefaultPath is ~/.config/eightsleep/config.yaml when it exists, else the eightctl path every existing setup uses.

Types

type Flags

type Flags struct {
	Config       string
	Email        string
	Password     string
	UserID       string
	ClientID     string
	ClientSecret string
	Timezone     string
	Output       string
	Verbose      bool
	Quiet        bool
}

Flags are the root flag values. Empty means not given.

type Settings

type Settings struct {
	Email        string
	Password     string
	UserID       string
	ClientID     string
	ClientSecret string
	// Timezone is an IANA zone name or "local".
	Timezone string
	// Output is the human output format: table, json or csv.
	Output  string
	Verbose bool
	// Quiet suppresses the config-file notice.
	Quiet bool
	// AwayQuiet suppresses the away on/off confirmation line. eightctl read
	// it from EIGHTCTL_QUIET or the config's quiet key.
	AwayQuiet bool
	// Path is the config file that was read, or empty.
	Path string
	// Data is that file's contents, for the daemon's schedule.
	Data []byte
	// Mode is the file's permission bits.
	Mode fs.FileMode
}

Settings are the merged values.

func Load

func Load(f Flags, home string, getenv func(string) string) (Settings, error)

Load reads the settings. home is the user's home directory and getenv reads the environment.

func (Settings) Insecure

func (s Settings) Insecure() bool

Insecure reports whether the config file is readable by group or others.

Jump to

Keyboard shortcuts

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