config

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

config provides flag and configuration file reading for satinv

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	API struct {
		BaseURL  string `yaml:"baseurl"`
		CertFile string `yaml:"certfile"`
		Password string `yaml:"password"`
		User     string `yaml:"user"`
	} `yaml:"api"`
	Cache struct {
		Dir               string `yaml:"dir"`
		Validity          int64  `yaml:"validity"`
		InventoryValidity int64  `yaml:"inventory_validity"`
	} `yaml:"cache"`
	CIDRs           map[string]string `yaml:"cidrs"`
	InventoryPrefix string            `yaml:"inventory_prefix"`
	Valid           struct {
		Days         int      `yaml:"days"`
		ExcludeHosts []string `yaml:"exclude_hosts"`
		ExcludeRegex []string `yaml:"exclude_regex"`
	} `yaml:"valid"`
}

Config contains all the configuration settings

func ParseConfig

func ParseConfig(filename string) (*Config, error)

ParseConfig expects a YAML formatted config file and populates a Config struct

func (*Config) WriteConfig

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

WriteConfig will create a YAML formatted config file from a Config struct

type Flags

type Flags struct {
	Config  string
	Debug   bool
	List    bool
	Refresh bool
}

Flags are the command line flags

func ParseFlags

func ParseFlags() *Flags

ParseFlags transcribes command line flags into a struct

Jump to

Keyboard shortcuts

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