appconfig

package
v1.261006.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MPL-2.0 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserTokenFromFile added in v1.261001.1

func UserTokenFromFile(configDir string) string

UserTokenFromFile returns the user token recorded in <configDir>/config.json without building a Config — and so without opening the database.

Commands that talk to an already-running server (`log`, `open`, the running half of `status`) need exactly two things: the live port, which comes from the runtime port file, and this token for the server's API. Going through Config for the token would open tingly.db alongside the server, which is the second-writer hazard described on app.AppManager.

A missing or unreadable file yields "" — the same as a config that has no token — so callers fall back to the unauthenticated URL as they always did.

Types

type AppConfig

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

AppConfig holds the application configuration

func NewAppConfig

func NewAppConfig(opts ...AppConfigOption) (*AppConfig, error)

NewAppConfig creates a new application configuration with default options

func (*AppConfig) AddProvider

func (ac *AppConfig) AddProvider(provider *typ.Provider) error

func (*AppConfig) AddProviderByName

func (ac *AppConfig) AddProviderByName(name, apiBase, token string) error

func (*AppConfig) ConfigDir

func (ac *AppConfig) ConfigDir() string

func (*AppConfig) DeleteProvider

func (ac *AppConfig) DeleteProvider(name string) error

func (*AppConfig) FetchAndSaveProviderModels

func (ac *AppConfig) FetchAndSaveProviderModels(providerName string) error

FetchAndSaveProviderModels fetches models from a provider and saves them

func (*AppConfig) GetDebug

func (ac *AppConfig) GetDebug() bool

func (*AppConfig) GetGUIDebug

func (ac *AppConfig) GetGUIDebug() bool

func (*AppConfig) GetGUIPort

func (ac *AppConfig) GetGUIPort() int

func (*AppConfig) GetGUIVerbose

func (ac *AppConfig) GetGUIVerbose() bool

func (*AppConfig) GetGlobalConfig

func (ac *AppConfig) GetGlobalConfig() *config.Config

GetGlobalConfig returns the underlying configuration manager

func (*AppConfig) GetJWTSecret

func (ac *AppConfig) GetJWTSecret() string

func (*AppConfig) GetOpenBrowser

func (ac *AppConfig) GetOpenBrowser() bool

func (*AppConfig) GetProviderByName

func (ac *AppConfig) GetProviderByName(name string) (*typ.Provider, error)

func (*AppConfig) GetProviderByUUID

func (ac *AppConfig) GetProviderByUUID(uuid string) (*typ.Provider, error)

func (*AppConfig) GetServerPort

func (ac *AppConfig) GetServerPort() int

func (*AppConfig) GetVerbose

func (ac *AppConfig) GetVerbose() bool

func (*AppConfig) GetVersion

func (ac *AppConfig) GetVersion() string

func (*AppConfig) ListProviders

func (ac *AppConfig) ListProviders() []*typ.Provider

func (*AppConfig) Save

func (ac *AppConfig) Save() error

Save saves the configuration to file with pretty-printed, HTML-unescaped JSON.

func (*AppConfig) SetDebug

func (ac *AppConfig) SetDebug(debug bool) error

func (*AppConfig) SetGUIDebug

func (ac *AppConfig) SetGUIDebug(debug bool) error

func (*AppConfig) SetGUIPort

func (ac *AppConfig) SetGUIPort(port int) error

func (*AppConfig) SetGUIVerbose

func (ac *AppConfig) SetGUIVerbose(verbose bool) error

func (*AppConfig) SetOpenBrowser

func (ac *AppConfig) SetOpenBrowser(v bool) error

func (*AppConfig) SetServerPort

func (ac *AppConfig) SetServerPort(port int) error

func (*AppConfig) SetVerbose

func (ac *AppConfig) SetVerbose(verbose bool) error

func (*AppConfig) SetVersion

func (ac *AppConfig) SetVersion(version string)

func (*AppConfig) UpdateProvider

func (ac *AppConfig) UpdateProvider(uuid string, provider *typ.Provider) error

type AppConfigOption

type AppConfigOption func(*appConfigOptions)

AppConfigOption defines a functional option for AppConfig

func WithConfigDir

func WithConfigDir(dir string) AppConfigOption

WithConfigDir sets a custom config directory for AppConfig

Jump to

Keyboard shortcuts

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