config

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register added in v0.73.0

func Register(flagSet *pflag.FlagSet) error

Types

type ClientConfig

type ClientConfig struct {
	Cli struct {
		Style string
	}
	Api struct {
		Host     string
		Key      string
		PageSize int
		Page     int
		Protocol string
		Port     int
	}
}

Struct ClientConfig holds config options needed by a client. Example uses are:

  • Cli output style
  • Remote (or local) API connection informations

type Config

type Config struct {
	// Client configuration
	Client ClientConfig

	// Server configuration
	Server ServerConfig
}

Struct Config is used as the primary target for viper.Unmarshal() in haul

It tries to contain all possible configuration options, and will apply the proper defaults set by cobra.

Config options are split between Config.Server and Config.Client.

func Unmarshal

func Unmarshal() (cfg Config, err error)

Unmarshal returns a Config instance filled by viper.Unmarshal

Because of viper.Unmarshal, this will parse the config file or files before parsing the command-line flags.

type ServerConfig

type ServerConfig struct {
	Api struct {
		Key  string
		Port int
		TLS  struct {
			Enabled bool
			Cert    string
			Key     string
		}
	}
	Postgres struct {
		Database   string
		Host       string
		Password   string
		Port       int
		User       string
		SSLEnabled bool
	}
}

Struct ServerConfig holds config options needed by a server. Examples uses are:

  • API server configurations for hosting
  • Database connection informations

Jump to

Keyboard shortcuts

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