conf

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

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

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetHashPrefixAndSuffix getHashPrefixAndSuffixFunc = normalGetHashPrefixAndSuffix

Functions

func ReadPrefixedOptions

func ReadPrefixedOptions(conf Section, prefixName string, defaults map[string][]string) map[string][]string

func ReadResellerOptions

func ReadResellerOptions(conf Section, defaults map[string][]string) ([]string, map[string]map[string][]string)

func UidFromConf

func UidFromConf(path string) (uint32, uint32, error)

UidFromConf returns the uid and gid for the user set in the first config found.

Types

type Config

type Config struct{ ini.File }

Config represents an ini file.

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig loads an ini from a path. The path should be a *.conf file or a *.conf.d directory.

func LoadConfigs

func LoadConfigs(path string) ([]Config, error)

LoadConfigs finds and loads any configs that exist for the given path. Multiple configs are supported for things like SAIO setups.

func StringConfig

func StringConfig(data string) (Config, error)

StringConfig returns an Config from a string, for use in tests.

func (Config) Get

func (f Config) Get(section string, key string) (string, bool)

Get fetches a value from the Config, looking in the DEFAULT section if not found in the specific section. Also ignores "set " key prefixes, like paste.

func (Config) GetBool

func (f Config) GetBool(section string, key string, dfl bool) bool

GetBool loads a true/false value from the config, with support for things like "yes", "true", "1", "t", etc.

func (Config) GetDefault

func (f Config) GetDefault(section string, key string, dfl string) string

GetDefault returns a value from the config, or returns the default setting if the entry doesn't exist.

func (Config) GetFloat

func (f Config) GetFloat(section string, key string, dfl float64) float64

GetFloat loads an entry from the config, parsed as a floating point value.

func (Config) GetInt

func (f Config) GetInt(section string, key string, dfl int64) int64

GetInt loads an entry from the config, parsed as an integer value.

func (Config) GetLimit

func (f Config) GetLimit(section string, key string, dfla int64, dflb int64) (int64, int64)

GetLimit loads an entry from the config in the format of %d/%d.

func (Config) GetSection

func (f Config) GetSection(section string) Section

GetSection returns a Section struct.

func (Config) HasSection

func (f Config) HasSection(section string) bool

HasSection determines whether or not the section exists in the ini file.

type Policy

type Policy struct {
	Index      int
	Type       string
	Name       string
	Aliases    []string
	Default    bool
	Deprecated bool
	Config     map[string]string
}

type PolicyList

type PolicyList map[int]*Policy

func GetPolicies

func GetPolicies() (PolicyList, error)

LoadPolicies loads policies, probably from /etc/swift/swift.conf

func (PolicyList) Default

func (p PolicyList) Default() int

func (PolicyList) GetPolicyInfo

func (p PolicyList) GetPolicyInfo() []map[string]interface{}

func (PolicyList) NameLookup

func (p PolicyList) NameLookup(s string) *Policy

type Section

type Section struct {
	ini.Section
	// contains filtered or unexported fields
}

func (Section) Get

func (s Section) Get(key string) (string, bool)

func (Section) GetBool

func (s Section) GetBool(key string, dfl bool) bool

func (Section) GetDefault

func (s Section) GetDefault(key string, dfl string) string

func (Section) GetFloat

func (s Section) GetFloat(key string, dfl float64) float64

func (Section) GetInt

func (s Section) GetInt(key string, dfl int64) int64

func (Section) GetLimit

func (s Section) GetLimit(key string, dfla int64, dflb int64) (int64, int64)

type SyncRealm

type SyncRealm struct {
	Name     string
	Key1     string
	Key2     string
	Clusters map[string]string
}

type SyncRealmList

type SyncRealmList map[string]SyncRealm

func GetSyncRealms

func GetSyncRealms() (SyncRealmList, error)

func (SyncRealmList) ValidateSyncTo

func (l SyncRealmList) ValidateSyncTo(syncHeader string) bool

Jump to

Keyboard shortcuts

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