config

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigMissingParameter raised when one of the required config parameters are missing
	ErrConfigMissingParameter = errors.New("missing required configuration parameter")
)

Functions

func NewYamlConfig

func NewYamlConfig(pathtoconfig string, configObject interface{}) error

NewYamlConfig loads the conf.yaml file and return the new config

Types

type AuthTokenSection

type AuthTokenSection struct {
	Enabled bool   `yaml:"enabled"`
	Token   string `yaml:"token"`
	Header  string `yaml:"header"`
	Path    string `yaml:"path"`
}

AuthTokenSection for simple authorization token

type JWTTokenSection

type JWTTokenSection struct {
	Enabled    bool   `yaml:"enabled"`
	SecretKey  string `yaml:"secret_key"`
	CookieName string `yaml:"cookie_name"`
}

JWTTokenSection for JWT token authorization middleware

type YamlConfig

type YamlConfig struct {
	Version     string           `yaml:"version"`     // Version of the server
	Port        int              `yaml:"port"`        // Server port
	Swagger     bool             `yaml:"swagger"`     // Swagger on/off
	Title       string           `yaml:"title"`       // Service title
	Description string           `yaml:"description"` // Service description
	Mode        string           `yaml:"mode"`        // debug/release
	AuthToken   AuthTokenSection `yaml:"auth_token"`
	JWTToken    JWTTokenSection  `yaml:"jwt_token"`
}

YamlConfig exports crucial microservice settings

func (*YamlConfig) LoadConfig

func (c *YamlConfig) LoadConfig(pathToConfig string, config interface{}) error

LoadConfig reads local config.yaml file

Jump to

Keyboard shortcuts

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