config

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: GPL-3.0 Imports: 4 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 handles reading and writing of ~/.invoicer/config.yaml.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDatabasePath

func DefaultDatabasePath() (string, error)

DefaultDatabasePath returns the default path to the invoice database (~/.invoicer/invoices.db).

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the default path to the config file (~/.invoicer/config.yaml).

func Save

func Save(path string, updates *Config) error

Save writes the config to the given path, creating the directory and file if needed. It merges the provided updates into any existing config, only overwriting fields that are explicitly set in updates.

Types

type Config

type Config struct {
	Vendor        string  `yaml:"vendor,omitempty"`
	Customer      string  `yaml:"customer,omitempty"`
	CustomerEmail string  `yaml:"customerEmail,omitempty"`
	Rate          float64 `yaml:"rate,omitempty"`
	Hours         float64 `yaml:"hours,omitempty"`
	Project       string  `yaml:"project,omitempty"`
	Database      string  `yaml:"database,omitempty"`

	// BaseURL is the public address of the web app.
	BaseURL string `yaml:"baseUrl,omitempty"`
	// OIDC holds the web app's access settings.
	OIDC *OIDC `yaml:"oidc,omitempty"`
	// Resend holds the email sending settings.
	Resend *Resend `yaml:"resend,omitempty"`
}

Config holds configuration values for invoicer. Only pointer fields are written when explicitly set; nil means "not configured".

func Load

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

Load reads the config file at the given path. If the file does not exist, an empty Config is returned without error.

type OIDC

type OIDC struct {
	Issuer           string `yaml:"issuer,omitempty"`
	ClientID         string `yaml:"clientId,omitempty"`
	ClientSecretFile string `yaml:"clientSecretFile,omitempty"`
	CookieKeyFile    string `yaml:"cookieKeyFile,omitempty"`
	AdminGroup       string `yaml:"adminGroup,omitempty"`
	CustomerGroup    string `yaml:"customerGroup,omitempty"`
	GroupsClaim      string `yaml:"groupsClaim,omitempty"`
}

OIDC holds the web app's OpenID Connect settings.

type Resend added in v0.2.4

type Resend struct {
	APIKeyFile string `yaml:"apiKeyFile,omitempty"`
	From       string `yaml:"from,omitempty"`
}

Resend holds the settings for sending invoice email through Resend.

func (*Resend) Configured added in v0.2.4

func (r *Resend) Configured() bool

Configured reports whether the config sets any email sending setting.

Jump to

Keyboard shortcuts

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