config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveSettingsToFile

func SaveSettingsToFile(filePath string, settings Settings) error

Function to save settings to file

Types

type Client

type Client struct {
	HttpClient *http.Client
	BaseURL    string
}

func NewClient

func NewClient(address string) *Client

Initializes a new Client struct

type Config

type Config struct {
	Client          *Client           // Http client for handling server requests
	Db              *database.Queries // Local database queries
	ConfigFP        string            // Config file path
	OperatingSystem string            // Local operating system
	SettingsFP      string            // Settings filepath
	Settings        Settings          // Holds settings loaded from config file
}

CLI config struct

func LoadConfig

func LoadConfig() (*Config, error)

Initializes configuration struct

func (*Config) MakeBasicRequest

func (c *Config) MakeBasicRequest(method, url, token string, data any) (*http.Response, error)

Structure a basic Http request with required data

type Settings

type Settings struct {
	DefaultItem    models.ItemName  `json:"default_item"`
	DefaultAccount database.Account `json:"default_account"`
}

Settings loaded from config file

Jump to

Keyboard shortcuts

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