config

package
v0.0.0-...-3b9fef2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureCLIConfigDir

func EnsureCLIConfigDir() (string, error)

EnsureCLIConfigDir ensures that the CLI config directory exists. If it does not exist, it will be created. Returns the path to the directory.

func EnsureCLIConfigFile

func EnsureCLIConfigFile(configDir string) (string, error)

EnsureCLIConfigFile ensures that the CLI config file exists. If it does not exist, it will be created. Returns the path to the file.

func ProcessConfig

func ProcessConfig(config *CLIConfig) error

ProcessConfig processes the CLI config provided from the config file. It sets default values for any missing fields. It also sets fields based on other fields.

Types

type CLIConfig

type CLIConfig struct {
	Server string `yaml:"server"`
	Port   int    `yaml:"port"`
	UseTLS bool   `yaml:"use_tls"`
	APIKey string `yaml:"api_key"`

	// Though these are processed by ProcessConfig
	// they could also be provided if needed.
	Protocol string `yaml:"protocol"`
	BaseURL  string `yaml:"base_url"`

	// These are not used by the CLI, but are used by the application
	ConfigDir string `yaml:"-"`
}

func GetCLIConfig

func GetCLIConfig() (*CLIConfig, error)

func ReadConfigFile

func ReadConfigFile(configPath string) (*CLIConfig, error)

ReadConfigFile reads the CLI config file and returns a CLIConfig struct.

Jump to

Keyboard shortcuts

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