Documentation
¶
Index ¶
- func UserTokenFromFile(configDir string) string
- type AppConfig
- func (ac *AppConfig) AddProvider(provider *typ.Provider) error
- func (ac *AppConfig) AddProviderByName(name, apiBase, token string) error
- func (ac *AppConfig) ConfigDir() string
- func (ac *AppConfig) DeleteProvider(name string) error
- func (ac *AppConfig) FetchAndSaveProviderModels(providerName string) error
- func (ac *AppConfig) GetDebug() bool
- func (ac *AppConfig) GetGUIDebug() bool
- func (ac *AppConfig) GetGUIPort() int
- func (ac *AppConfig) GetGUIVerbose() bool
- func (ac *AppConfig) GetGlobalConfig() *config.Config
- func (ac *AppConfig) GetJWTSecret() string
- func (ac *AppConfig) GetOpenBrowser() bool
- func (ac *AppConfig) GetProviderByName(name string) (*typ.Provider, error)
- func (ac *AppConfig) GetProviderByUUID(uuid string) (*typ.Provider, error)
- func (ac *AppConfig) GetServerPort() int
- func (ac *AppConfig) GetVerbose() bool
- func (ac *AppConfig) GetVersion() string
- func (ac *AppConfig) ListProviders() []*typ.Provider
- func (ac *AppConfig) Save() error
- func (ac *AppConfig) SetDebug(debug bool) error
- func (ac *AppConfig) SetGUIDebug(debug bool) error
- func (ac *AppConfig) SetGUIPort(port int) error
- func (ac *AppConfig) SetGUIVerbose(verbose bool) error
- func (ac *AppConfig) SetOpenBrowser(v bool) error
- func (ac *AppConfig) SetServerPort(port int) error
- func (ac *AppConfig) SetVerbose(verbose bool) error
- func (ac *AppConfig) SetVersion(version string)
- func (ac *AppConfig) UpdateProvider(uuid string, provider *typ.Provider) error
- type AppConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UserTokenFromFile ¶ added in v1.261001.1
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) AddProviderByName ¶
func (*AppConfig) DeleteProvider ¶
func (*AppConfig) FetchAndSaveProviderModels ¶
FetchAndSaveProviderModels fetches models from a provider and saves them
func (*AppConfig) GetGUIDebug ¶
func (*AppConfig) GetGUIPort ¶
func (*AppConfig) GetGUIVerbose ¶
func (*AppConfig) GetGlobalConfig ¶
GetGlobalConfig returns the underlying configuration manager
func (*AppConfig) GetJWTSecret ¶
func (*AppConfig) GetOpenBrowser ¶
func (*AppConfig) GetProviderByName ¶
func (*AppConfig) GetProviderByUUID ¶
func (*AppConfig) GetServerPort ¶
func (*AppConfig) GetVerbose ¶
func (*AppConfig) GetVersion ¶
func (*AppConfig) ListProviders ¶
func (*AppConfig) Save ¶
Save saves the configuration to file with pretty-printed, HTML-unescaped JSON.
func (*AppConfig) SetGUIDebug ¶
func (*AppConfig) SetGUIPort ¶
func (*AppConfig) SetGUIVerbose ¶
func (*AppConfig) SetOpenBrowser ¶
func (*AppConfig) SetServerPort ¶
func (*AppConfig) SetVerbose ¶
func (*AppConfig) SetVersion ¶
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