config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MPL-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NoAuthProvider          AuthProvider            = "none"
	BasicAuthProvider       AuthProvider            = "basic"
	RedisQueueProvider      QueueProvider           = "redis"
	DefaultStrategyProvider StrategyProvider        = "default"
	DefaultSignatureHeader  SignatureHeaderProvider = "X-Convoy-Signature"
)
View Source
const (
	DevelopmentEnvironment string = "development"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(p string) error

Types

type AuthConfiguration

type AuthConfiguration struct {
	Type  AuthProvider `json:"type"`
	Basic Basic        `json:"basic"`
}

type AuthProvider

type AuthProvider string

type Basic added in v0.1.2

type Basic struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Configuration

type Configuration struct {
	Auth              AuthConfiguration      `json:"auth,omitempty"`
	UIAuth            UIAuthConfiguration    `json:"ui,omitempty"`
	UIAuthorizedUsers map[string]string      `json:"-"`
	Database          DatabaseConfiguration  `json:"database"`
	Sentry            SentryConfiguration    `json:"sentry"`
	Queue             QueueConfiguration     `json:"queue"`
	Server            ServerConfiguration    `json:"server"`
	Strategy          StrategyConfiguration  `json:"strategy"`
	Signature         SignatureConfiguration `json:"signature"`
	SMTP              SMTPConfiguration      `json:"smtp"`
	Environment       string                 `json:"env"`
	DisableEndpoint   bool                   `json:"disable_endpoint"`
}

func Get

func Get() (Configuration, error)

Get fetches the application configuration. LoadConfig must have been called previously for this to work. Use this when you need to get access to the config object at runtime

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Dsn string `json:"dsn"`
}

type QueueConfiguration

type QueueConfiguration struct {
	Type  QueueProvider `json:"type"`
	Redis struct {
		DSN string `json:"dsn"`
	} `json:"redis"`
}

type QueueProvider

type QueueProvider string

type SMTPConfiguration

type SMTPConfiguration struct {
	Provider string `json:"provider"`
	URL      string `json:"url"`
	Port     uint32 `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	From     string `json:"from"`
	ReplyTo  string `json:"reply-to"`
}

type SentryConfiguration

type SentryConfiguration struct {
	Dsn string `json:"dsn"`
}

type ServerConfiguration

type ServerConfiguration struct {
	HTTP struct {
		Port uint32 `json:"port"`
	} `json:"http"`
}

type SignatureConfiguration

type SignatureConfiguration struct {
	Header SignatureHeaderProvider `json:"header"`
	Hash   string                  `json:"hash"`
}

type SignatureHeaderProvider

type SignatureHeaderProvider string

func (SignatureHeaderProvider) String

func (s SignatureHeaderProvider) String() string

type StrategyConfiguration

type StrategyConfiguration struct {
	Type    StrategyProvider `json:"type"`
	Default struct {
		IntervalSeconds uint64 `json:"intervalSeconds"`
		RetryLimit      uint64 `json:"retryLimit"`
	} `json:"default"`
}

type StrategyProvider

type StrategyProvider string

type UIAuthConfiguration added in v0.1.2

type UIAuthConfiguration struct {
	Type                  AuthProvider  `json:"type"`
	Basic                 []Basic       `json:"basic"`
	JwtKey                string        `json:"jwtKey"`
	JwtTokenExpirySeconds time.Duration `json:"jwtTokenExpirySeconds"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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