config

package
v0.0.0-...-2c762cd Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

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 a thread-safe key-value config, which can be marshalled to YAML.

func New

func New() *Config

New creates a new config.

func Read

func Read(r io.Reader) (*Config, error)

Read configuration in YAML format from reader r.

func (*Config) Del

func (c *Config) Del(key string)

Del removes the value associated with key.

func (*Config) Get

func (c *Config) Get(key string) (string, bool)

Get returns the value associated with key.

func (*Config) Keys

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

Keys returns a sorted slice of keys set in this config.

func (*Config) Set

func (c *Config) Set(key, value string)

Set associates key with value.

func (*Config) Write

func (c *Config) Write(w io.Writer) error

Write writes config in YAML format to writer w.

func (*Config) WriteFile

func (c *Config) WriteFile(filename string) error

WriteFile writes the config to a temporary file in the parent directory of filename, then renames the temporary file to filename.

Jump to

Keyboard shortcuts

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