config

package
v0.0.0-...-3da7291 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabaseCfg

func GetDatabaseCfg() *databaseCfg

func GetJWTCfg

func GetJWTCfg() *jwtCfg

func GetJWTEmailClaim

func GetJWTEmailClaim(token *jwt.Token) string

func GetJWTUserIDClaim

func GetJWTUserIDClaim(token *jwt.Token) int

func GetJWTUsernameClaim

func GetJWTUsernameClaim(token *jwt.Token) string

func GetMailSenderCfg

func GetMailSenderCfg() *mailSender

func GetVault

func GetVault() string

func NewDatabaseCfg

func NewDatabaseCfg(applicationProperties *ApplicationProperties) (*databaseCfg, error)

func NewJWTCfg

func NewJWTCfg(applicationProperties *ApplicationProperties) (*jwtCfg, error)

func NewMailSender

func NewMailSender(applicationProperties *ApplicationProperties) *mailSender

Types

type ApplicationProperties

type ApplicationProperties struct {
	Services  Services `yaml:"services,omitempty"`
	Security  Security `yaml:"security,omitempty"`
	VaultType string   `yaml:"vaultType,omitempty"`
	User      User     `yaml:"user,omitempty"`
}

func LoadApplicationProperties

func LoadApplicationProperties(propsFile string) (*ApplicationProperties, error)

type Authentication

type Authentication struct {
	JWT JWTAuth `yaml:"JWT,omitempty"`
}

type HTTPError

type HTTPError struct {
	// contains filtered or unexported fields
}

HTTPError represents a HTTP response error

func ParseToken

func ParseToken(w http.ResponseWriter, r *http.Request) (*jwt.Token, HTTPError)

ParseToken parses the token provided in the request header

func (HTTPError) Error

func (h HTTPError) Error() error

func (HTTPError) StatusCode

func (h HTTPError) StatusCode() int

type InfluxProperties

type InfluxProperties struct {
	DatabaseName string `yaml:"databaseName,omitempty"`
	TokenSecret  string `yaml:"tokenSecret,omitempty"`
	ServiceName  string `yaml:"serviceName,omitempty"`
	Org          string `yaml:"org,omitempty"`
	Bucket       string `yaml:"bucket,omitempty"`
	Port         string `yaml:"port,omitempty"`
}

type JWTAuth

type JWTAuth struct {
	JWTAudienceSecret string `yaml:"jwtAudienceSecret,omitempty"`
	JWTIssuerSecret   string `yaml:"jwtIssuerSecret,omitempty"`
	JWTSigningKey     string `yaml:"jwtSigningKey,omitempty"`
	ExpirationTime    string `yaml:"expirationTime,omitempty"`
}

type MailSenderProperties

type MailSenderProperties struct {
	ServiceName string `yaml:"serviceName,omitempty"`
	Port        string `yaml:"port,omitempty"`
}

type PostgreProperties

type PostgreProperties struct {
	DatabaseName   string `yaml:"databaseName,omitempty"`
	PasswordSecret string `yaml:"passwordSecret,omitempty"`
	ServiceName    string `yaml:"serviceName,omitempty"`
	SSLMode        string `yaml:"sslmode,omitempty"`
	Port           string `yaml:"port,omitempty"`
}

type Security

type Security struct {
	TLS            TLS            `yaml:"tls,omitempty"`
	Authentication Authentication `yaml:"authentication,omitempty"`
}

type Services

type Services struct {
	InfluxProps  InfluxProperties     `yaml:"influxdb,omitempty"`
	PostgreProps PostgreProperties    `yaml:"postgresdb,omitempty"`
	MailSender   MailSenderProperties `yaml:"mailsender,omitempty"`
}

type TLS

type TLS struct {
	CertFile   string `yaml:"certFile,omitempty"`
	PrivateKey string `yaml:"privateKey,omitempty"`
	RootCACert string `yaml:"rootCACert,omitempty"`
	RootCAKey  string `yaml:"rootCAKey,omitempty"`
}

func GetTLSCfg

func GetTLSCfg() *TLS

type User

type User struct {
	UserSecret string `yaml:"userSecret"`
	FirstName  string `yaml:"firstname"`
	LastName   string `yaml:"lastname"`
	Email      string `yaml:"email"`
}

func GetUserCfg

func GetUserCfg() User

Jump to

Keyboard shortcuts

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