configurator

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package configurator provides read / write functionalities to manage application configuration.

Index

Constants

This section is empty.

Variables

View Source
var ErrConfigIsDir = errors.New("config file is a directory")

ErrConfigIsDir indicates that the config file is a directory.

Functions

This section is empty.

Types

type Option

type Option func(c *PromptConfigurator)

Option configures Configurator.

func WithFileSystem added in v0.4.8

func WithFileSystem(fs afero.Fs) Option

WithFileSystem sets filesystem for PromptConfigurator.

func WithStdio

func WithStdio(stdio terminal.Stdio) Option

WithStdio configures stdio for prompt.

func WithStdioProvider

func WithStdioProvider(p cobra.StdioProvider) Option

WithStdioProvider configures stdio for prompt.

type PromptConfigurator

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

PromptConfigurator manages service.Config.

func New

func New(configFile string, options ...Option) *PromptConfigurator

New creates a new Configurator.

func (*PromptConfigurator) Clean

func (c *PromptConfigurator) Clean(oldCfg service.Config, newCfg service.Config) error

Clean cleans old obsolete from storage.

func (*PromptConfigurator) Configurator added in v0.4.8

func (c *PromptConfigurator) Configurator() service.Configurator

Configurator provides Configurator.

func (*PromptConfigurator) Configure

func (c *PromptConfigurator) Configure() (err error)

Configure runs the configuration prompt.

func (*PromptConfigurator) Read

func (c *PromptConfigurator) Read() (service.Config, error)

Read reads configuration from config file.

func (*PromptConfigurator) SafeRead

func (c *PromptConfigurator) SafeRead() (service.Config, error)

SafeRead is the same as Read but does not return error if the config file is missing.

func (*PromptConfigurator) Write

func (c *PromptConfigurator) Write(cfg service.Config) error

Write writes configuration to config file and external storage.

Jump to

Keyboard shortcuts

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