config

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config handles configuration management for teacli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config represents the CLI configuration

func Load

func Load() (*Config, error)

Load loads configuration from the default location

func LoadFrom added in v1.0.1

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

LoadFrom loads configuration from path, or from the default location when path is empty. This is what the --config flag resolves to.

func (*Config) AddServer

func (c *Config) AddServer(name, url, token string) error

AddServer adds or updates a server configuration

func (*Config) GetDefaultServer

func (c *Config) GetDefaultServer() (*ServerConfig, error)

GetDefaultServer returns the default server configuration

func (*Config) GetDefaultServerName added in v1.0.2

func (c *Config) GetDefaultServerName() (string, error)

GetDefaultServerName returns the configured name of the default server.

func (*Config) GetServer

func (c *Config) GetServer(name string) (*ServerConfig, error)

GetServer retrieves a server configuration by name

func (*Config) ListServers

func (c *Config) ListServers() []string

ListServers returns all configured server names

func (*Config) RemoveServer

func (c *Config) RemoveServer(name string) error

RemoveServer removes a server configuration

func (*Config) Save

func (c *Config) Save() error

Save persists the configuration to disk

func (*Config) SetDefaultServer

func (c *Config) SetDefaultServer(name string) error

SetDefaultServer sets the default server

type ServerConfig

type ServerConfig struct {
	URL     string `ini:"url"`
	Token   string `ini:"token"`
	Timeout int    `ini:"timeout,omitempty"`
}

ServerConfig holds configuration for a single Gitea server

Jump to

Keyboard shortcuts

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