config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Yaml       *YamlConfig
	KeysMap    map[string]bool
	PathPrefix string
}

Config global config variable

var Conf *Config

Conf global variable for storing the config from the file

func Load

func Load(pathPrefix string) (*Config, error)

Load config from the config.yaml file

func (*Config) CheckKey

func (c *Config) CheckKey() bool

CheckKey will make sure there is a key available

func (*Config) CreateKeyMap

func (c *Config) CreateKeyMap()

CreateKeyMap will take an array of keys and turn it in to a map for quicker authentication

func (*Config) Update

func (c *Config) Update()

Update will take the current stuct and turn it back to the yaml file

type YamlConfig

type YamlConfig struct {
	ControlPlane struct {
		Host           string   `yaml:"host"`
		Port           string   `yaml:"port"`
		HTPasswd       string   `yaml:"htpasswd"`
		NumberOfKeys   int      `yaml:"number-of-keys"`
		Keys           []string `yaml:"keys"`
		AllowedOrigins []string `yaml:"allowed-origins"`
	} `yaml:"control-plane"`
	Bucket struct {
		Location string `yaml:"filename"`
		Export   struct {
			Allowed     bool   `yaml:"allowed"`
			Compression string `yaml:"compression"`
		} `yaml:"export"`
	} `yaml:"bucket"`
}

YamlConfig stuct for yaml file

Jump to

Keyboard shortcuts

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