config

package
v0.0.0-...-4836e8e Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URLFmt = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-%s&license_key=%s&suffix=tar.gz"
)

Variables

View Source
var Cfg = new(Config)

Cfg is the global configuration variable through the entire program, it stores the all GeoLite2 database configurations, including Type and LicenseKey. You should call Initialize function first to initialize this variable.

Functions

func Initialize

func Initialize(c *cobra.Command)

Initialize parse the command line arguments, read license key from env, parse the json configuration file and then initialize the Cfg variable.

Types

type Config

type Config struct {
	Databases  []*GeoLite2DatabaseConfig `json:"databases"`
	AutoUpdate bool                      `json:"autoUpdate"`
	LicenseKey string                    `json:"licenseKey"`
	URLFmt     string                    `json:"urlFmt"`
	CacheDir   string                    `json:"cacheDir"`
}

func (*Config) UnmarshalJSON

func (g *Config) UnmarshalJSON(b []byte) error

type GeoLite2DatabaseConfig

type GeoLite2DatabaseConfig struct {
	Type       string `json:"type"`
	Path       string `json:"path"`
	AutoUpdate bool   `json:"autoUpdate"`
	LicenseKey string `json:"licenseKey"`
}

func (*GeoLite2DatabaseConfig) UnmarshalJSON

func (g *GeoLite2DatabaseConfig) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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