config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides configuration file management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir() string

DefaultConfigDir returns the default config directory.

func DefaultConfigPath

func DefaultConfigPath() string

DefaultConfigPath returns the default config file path.

func FormatMissingEnvVars

func FormatMissingEnvVars(missing []string, vars []RequiredEnvVar) string

FormatMissingEnvVars formats missing environment variables into a user-friendly error message.

func ValidateAPICredentials

func ValidateAPICredentials() error

ValidateAPICredentials validates Nylas API credentials from environment.

func ValidateRequiredEnvVars

func ValidateRequiredEnvVars(vars []RequiredEnvVar) []string

ValidateRequiredEnvVars validates that all required environment variables are set. Returns a slice of missing variables.

Types

type FileStore

type FileStore struct {
	// contains filtered or unexported fields
}

FileStore implements ConfigStore using a YAML file.

func NewDefaultFileStore

func NewDefaultFileStore() *FileStore

NewDefaultFileStore creates a FileStore at the default location.

func NewFileStore

func NewFileStore(path string) *FileStore

NewFileStore creates a new FileStore.

func (*FileStore) Exists

func (f *FileStore) Exists() bool

Exists returns true if the config file exists.

func (*FileStore) Load

func (f *FileStore) Load() (*domain.Config, error)

Load loads the configuration from the file.

func (*FileStore) Path

func (f *FileStore) Path() string

Path returns the path to the config file.

func (*FileStore) Save

func (f *FileStore) Save(config *domain.Config) error

Save saves the configuration to the file.

type MockConfigStore

type MockConfigStore struct {
	// contains filtered or unexported fields
}

MockConfigStore is a mock implementation of ConfigStore for testing.

func NewMockConfigStore

func NewMockConfigStore() *MockConfigStore

NewMockConfigStore creates a new MockConfigStore.

func (*MockConfigStore) Exists

func (m *MockConfigStore) Exists() bool

Exists returns whether the config exists.

func (*MockConfigStore) Load

func (m *MockConfigStore) Load() (*domain.Config, error)

Load loads the configuration.

func (*MockConfigStore) Path

func (m *MockConfigStore) Path() string

Path returns the mock path.

func (*MockConfigStore) Save

func (m *MockConfigStore) Save(config *domain.Config) error

Save saves the configuration.

func (*MockConfigStore) SetConfig

func (m *MockConfigStore) SetConfig(config *domain.Config)

SetConfig sets the mock config.

func (*MockConfigStore) SetExists

func (m *MockConfigStore) SetExists(exists bool)

SetExists sets whether the config file exists.

type RequiredEnvVar

type RequiredEnvVar struct {
	Name        string
	Description string
	Optional    bool
}

RequiredEnvVar represents a required environment variable.

Jump to

Keyboard shortcuts

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