config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package config provides types and handling for configuration values used in the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilePaths added in v0.4.0

func FilePaths() []string

FilePaths returns the paths of config files that may be searched for in the current environment.

This is useful for self-documentation, to provide clarity to users for where their config file may be loaded from.

Types

type Configuration

type Configuration struct {
	IndentationSize uint
	PreferredSource string
	Source          string
	// contains filtered or unexported fields
}

Configuration defines the application's configuration structure

func NewFromRuntime

func NewFromRuntime(
	flags *flag.FlagSet,
	providerConfigs map[string]registry.Configuration,
	defaults Configuration,
) (Configuration, error)

NewFromRuntime builds a Configuration by merging values from multiple different sources. It accepts a Configuration containing default values to fill in any empty/blank configuration values found when merging from the different sources.

The merging of values from different sources will take this priority: 1. Command line arguments 2. Environment variables 3. A loaded config file, if available 4. Passed in default values

func (Configuration) FilePath added in v0.4.0

func (c Configuration) FilePath() string

FilePath returns the path of the file that was loaded for the configuration.

func (Configuration) MarshalJSON

func (c Configuration) MarshalJSON() ([]byte, error)

MarshalJSON defines how the configuration should be JSON marshalled.

func (Configuration) ProviderConfigs

func (c Configuration) ProviderConfigs() []registry.Configuration

ProviderConfigs returns the configurations of the source providers.

func (*Configuration) UnmarshalJSON

func (c *Configuration) UnmarshalJSON(data []byte) error

UnmarshalJSON defines how the configuration should be JSON unmarshalled.

Jump to

Keyboard shortcuts

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