config

package
v0.4.15 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MPL-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RedisQueueProvider                 QueueProvider           = "redis"
	InMemoryQueueProvider              QueueProvider           = "in-memory"
	DefaultStrategyProvider            StrategyProvider        = "default"
	ExponentialBackoffStrategyProvider StrategyProvider        = "exponential-backoff"
	DefaultSignatureHeader             SignatureHeaderProvider = "X-Convoy-Signature"
	ConsoleLoggerProvider              LoggerProvider          = "console"
	NewRelicTracerProvider             TracerProvider          = "new_relic"
	RedisCacheProvider                 CacheProvider           = "redis"
)
View Source
const (
	DevelopmentEnvironment string = "development"
)
View Source
const MaxResponseSize = 50 * 1024

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(p string, override *Configuration) 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   auth.Role `json:"role"`
}

type AuthConfiguration

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

type AuthProvider

type AuthProvider string

type BasicAuth

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

type CacheConfiguration added in v0.4.10

type CacheConfiguration struct {
	Type  CacheProvider           `json:"type"`
	Redis RedisCacheConfiguration `json:"redis"`
}

type CacheProvider added in v0.4.10

type CacheProvider string

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"`
	MaxResponseSize uint64                `json:"max_response_size"`
	GroupConfig     GroupConfig           `json:"group"`
	SMTP            SMTPConfiguration     `json:"smtp"`
	Environment     string                `json:"env" envconfig:"CONVOY_ENV" required:"true" default:"development"`
	MultipleTenants bool                  `json:"multiple_tenants"`
	Logger          LoggerConfiguration   `json:"logger"`
	Tracer          TracerConfiguration   `json:"tracer"`
	NewRelic        NewRelicConfiguration `json:"new_relic"`
	Cache           CacheConfiguration    `json:"cache"`
	BaseUrl         string                `json:"base_url"`
}

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 {
	Type string `json:"type" envconfig:"CONVOY_DB_TYPE"`
	Dsn  string `json:"dsn" envconfig:"CONVOY_DB_DSN"`
}

type DefaultStrategyConfiguration

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

type ExponentialBackoffStrategyConfiguration added in v0.4.10

type ExponentialBackoffStrategyConfiguration struct {
	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  `json:"strategy"`
	Signature       SignatureConfiguration `json:"signature"`
	DisableEndpoint bool                   `json:"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"`
	WorkerPort  uint32 `json:"worker_port" envconfig:"WORKER_PORT"`
}

type LoggerConfiguration

type LoggerConfiguration struct {
	Type      LoggerProvider `json:"type"`
	ServerLog struct {
		Level string `json:"level"`
	} `json:"server_log"`
}

type LoggerProvider

type LoggerProvider string

type NativeRealmOptions

type NativeRealmOptions struct {
	Enabled bool `json:"enabled"`
}

type NewRelicConfiguration

type NewRelicConfiguration struct {
	AppName                  string `json:"app_name"`
	LicenseKey               string `json:"license_key"`
	ConfigEnabled            bool   `json:"config_enabled"`
	DistributedTracerEnabled bool   `json:"distributed_tracer_enabled"`
}

type QueueConfiguration

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

type QueueProvider

type QueueProvider string

type RedisCacheConfiguration added in v0.4.10

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

type RedisQueueConfiguration

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

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"`
	ExponentialBackoff ExponentialBackoffStrategyConfiguration `json:"exponentialBackoff,omitempty"`
}

type StrategyProvider

type StrategyProvider string

type TracerConfiguration

type TracerConfiguration struct {
	Type TracerProvider `json:"type"`
}

type TracerProvider

type TracerProvider string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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