config

package
v0.0.0-...-ed7ff26 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCacheDriver    = errors.New("invalid cache driver")
	ErrInvalidCacheRedisHost = errors.New("invalid redis host or port")
	ErrInvalidCacheRedisDB   = errors.New("invalid redis db")

	ErrInvalidOAuthProvider = errors.New("invalid oauth provider")

	ErrInvalidSessionBlockKey = errors.New("invalid session block key")
	ErrInvalidSessionHashKey  = errors.New("invalid session hash key")
	ErrMissingSessionDomain   = errors.New("missing session domain")
)

Functions

func GetAirports

func GetAirports() []string

func IsValidOAuth2Provider

func IsValidOAuth2Provider(provider string) bool

func ParseAirports

func ParseAirports(file string) error

func ParseConfig

func ParseConfig(file string) error

func ValidateCache

func ValidateCache(c *Cache) error

func ValidateConfig

func ValidateConfig(c *Config) error

func ValidateOAuth

func ValidateOAuth(o *OAuth) error

func ValidateSession

func ValidateSession(s *Session) error

Types

type Cache

type Cache struct {
	Driver            string           `json:"driver"`
	Host              string           `json:"host"`
	Port              int              `json:"port"`
	Password          string           `json:"password"`
	DB                int              `json:"db"`
	DefaultExpiration *CacheExpiration `json:"default_expiration"`
}

type CacheExpiration

type CacheExpiration struct {
	Airports int `json:"airports"`
	Charts   int `json:"charts"`
	PIREPs   int `json:"pireps"`
}

type Config

type Config struct {
	Cache    Cache    `json:"cache"`
	Database Database `json:"database"`
	Facility Facility `json:"facility"`
	OAuth    OAuth    `json:"oauth"`
	Server   Server   `json:"server"`
	Session  Session  `json:"session"`
}

func GetConfig

func GetConfig() *Config

type Database

type Database struct {
	Driver       string `json:"driver"`
	Host         string `json:"host"`
	Port         int    `json:"port"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	DatabaseName string `json:"database_name"`
	AutoMigrate  bool   `json:"auto_migrate"`
	CACert       string `json:"ca_cert"`
}

type Facility

type Facility struct {
	Identifier string      `json:"identifier"`
	Name       string      `json:"name"`
	ADH        FacilityADH `json:"adh"`
}

type FacilityADH

type FacilityADH struct {
	APIBase  string `json:"api_base"`
	Rostered bool   `json:"rostered"`
}

type OAuth

type OAuth struct {
	Provider     string         `json:"provider"`
	BaseURL      string         `json:"base_url"`
	ClientID     string         `json:"client_id"`
	ClientSecret string         `json:"client_secret"`
	MyBaseURL    string         `json:"my_base_url"`
	Endpoints    OAuthEndpoints `json:"endpoints"`
}

type OAuthEndpoints

type OAuthEndpoints struct {
	Authorization string `json:"authorize"`
	Token         string `json:"token"`
	Userinfo      string `json:"userinfo"`
}

type Server

type Server struct {
	IP   string `json:"ip"`
	Port int    `json:"port"`
	Mode string `json:"mode"`
}

type Session

type Session struct {
	HashKey  string `json:"hash_key"`
	BlockKey string `json:"block_key"`
	Name     string `json:"name"`
	Path     string `json:"path"`
	Domain   string `json:"domain"`
	MaxAge   int    `json:"max_age"`
	Secure   bool   `json:"secure"`
	HttpOnly bool   `json:"http_only"`
}

Jump to

Keyboard shortcuts

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