config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MPL-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DevelopmentEnvironment string = "development"

	RedisQueueProvider      QueueProvider           = "redis"
	DefaultStrategyProvider StrategyProvider        = "default"
	DefaultSignatureHeader  SignatureHeaderProvider = "X-Convoy-Signature"
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(p string) error

LoadConfig is used to load the configuration from either the json config file or the environment variables.

Types

type APIKeyAuth

type APIKeyAuth struct {
	APIKey string `json:"api_key"`
	Role   Role   `json:"role"`
}

type AuthConfiguration

type AuthConfiguration struct {
	RequireAuth bool            `json:"require_auth"`
	File        FileRealmOption `json:"file"`
}

type BasicAuth

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Role     Role   `json:"role"`
}

type Configuration

type Configuration struct {
	Auth            AuthConfiguration     `json:"auth,omitempty"`
	Database        DatabaseConfiguration `json:"database"`
	Sentry          SentryConfiguration   `json:"sentry"`
	Queue           QueueConfiguration    `json:"queue"`
	Server          ServerConfiguration   `json:"server"`
	GroupConfig     GroupConfig           `json:"group"`
	SMTP            SMTPConfiguration     `json:"smtp"`
	Environment     string                `json:"env" envconfig:"CONVOY_ENV" required:"true" default:"development"`
	MultipleTenants bool                  `json:"multiple_tenants"`
}

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" envconfig:"CONVOY_MONGO_DSN"`
}

type DefaultStrategyConfiguration

type DefaultStrategyConfiguration struct {
	IntervalSeconds uint64 `json:"intervalSeconds" envconfig:"CONVOY_INTERVAL_SECONDS"`
	RetryLimit      uint64 `json:"retryLimit" envconfig:"CONVOY_RETRY_LIMIT"`
}

type FileRealmOption

type FileRealmOption struct {
	Basic  []BasicAuth  `json:"basic" bson:"basic"`
	APIKey []APIKeyAuth `json:"api_key"`
}

type GroupConfig

type GroupConfig struct {
	Strategy        StrategyConfiguration
	Signature       SignatureConfiguration
	DisableEndpoint bool `envconfig:"CONVOY_DISABLE_ENDPOINT"`
}

type HTTPServerConfiguration

type HTTPServerConfiguration struct {
	SSL         bool   `json:"ssl" envconfig:"SSL"`
	SSLCertFile string `json:"ssl_cert_file" envconfig:"CONVOY_SSL_CERT_FILE"`
	SSLKeyFile  string `json:"ssl_key_file" envconfig:"CONVOY_SSL_KEY_FILE"`
	Port        uint32 `json:"port" envconfig:"PORT"`
}

type QueueConfiguration

type QueueConfiguration struct {
	Type  QueueProvider           `json:"type" envconfig:"CONVOY_QUEUE_PROVIDER"`
	Redis RedisQueueConfiguration `json:"redis"`
}

type QueueProvider

type QueueProvider string

type RedisQueueConfiguration

type RedisQueueConfiguration struct {
	DSN string `json:"dsn" envconfig:"CONVOY_REDIS_DSN"`
}

type Role added in v0.3.0

type Role = auth.Role

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" envconfig:"CONVOY_SENTRY_DSN"`
}

type ServerConfiguration

type ServerConfiguration struct {
	HTTP HTTPServerConfiguration `json:"http"`
}

type SignatureConfiguration

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

type SignatureHeaderProvider

type SignatureHeaderProvider string

func (SignatureHeaderProvider) String

func (s SignatureHeaderProvider) String() string

type StrategyConfiguration

type StrategyConfiguration struct {
	Type    StrategyProvider             `json:"type"`
	Default DefaultStrategyConfiguration `json:"default"`
}

type StrategyProvider

type StrategyProvider string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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