config

package
v0.6.0-rc.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MaxResponseSizeKb = 50                       // in kilobytes
	MaxResponseSize   = MaxResponseSizeKb * 1024 // in bytes
	MaxRequestSize    = MaxResponseSize
)
View Source
const (
	RedisQueueProvider                 QueueProvider           = "redis"
	DefaultStrategyProvider            StrategyProvider        = "linear"
	ExponentialBackoffStrategyProvider StrategyProvider        = "exponential"
	DefaultSignatureHeader             SignatureHeaderProvider = "X-Convoy-Signature"
	ConsoleLoggerProvider              LoggerProvider          = "console"
	NewRelicTracerProvider             TracerProvider          = "new_relic"
	RedisCacheProvider                 CacheProvider           = "redis"
	RedisLimiterProvider               LimiterProvider         = "redis"
	MongodbDatabaseProvider            DatabaseProvider        = "mongodb"
	InMemoryDatabaseProvider           DatabaseProvider        = "in-memory"
)
View Source
const (
	DevelopmentEnvironment string = "development"
)

Variables

This section is empty.

Functions

func IsStringEmpty added in v0.5.0

func IsStringEmpty(s string) bool

IsStringEmpty checks if the given string s is empty or not

func LoadConfig

func LoadConfig(p string) error

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

func OverrideConfigWithCliFlags added in v0.5.0

func OverrideConfigWithCliFlags(cmd *cobra.Command, cfg *Configuration) error

func SetServerConfigDefaults added in v0.5.0

func SetServerConfigDefaults(c *Configuration) error

Types

type APIKeyAuth

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

type APIKeyAuthConfig added in v0.5.0

type APIKeyAuthConfig []APIKeyAuth

func (*APIKeyAuthConfig) Decode added in v0.5.0

func (a *APIKeyAuthConfig) Decode(value string) error

Decode loads in config from an env var named `CONVOY_API_KEY_CONFIG`

type AuthConfiguration

type AuthConfiguration struct {
	File   FileRealmOption    `json:"file"`
	Native NativeRealmOptions `json:"native"`
	Jwt    JwtRealmOptions    `json:"jwt"`
}

type AuthProvider

type AuthProvider string

type BasicAuth

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

type BasicAuthConfig added in v0.5.0

type BasicAuthConfig []BasicAuth

func (*BasicAuthConfig) Decode added in v0.5.0

func (b *BasicAuthConfig) Decode(value string) error

Decode loads in config from an env var named `CONVOY_BASIC_AUTH_CONFIG`

type CacheConfiguration added in v0.4.10

type CacheConfiguration struct {
	Type  CacheProvider           `json:"type"  envconfig:"CONVOY_CACHE_PROVIDER"`
	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"`
	Prometheus      PrometheusConfiguration `json:"prometheus"`
	Server          ServerConfiguration     `json:"server"`
	MaxResponseSize uint64                  `json:"max_response_size" envconfig:"CONVOY_MAX_RESPONSE_SIZE"`
	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"`
	Cache           CacheConfiguration      `json:"cache"`
	Limiter         LimiterConfiguration    `json:"limiter"`
	Host            string                  `json:"host" envconfig:"CONVOY_HOST"`
	Search          SearchConfiguration     `json:"search"`
}

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

type DatabaseProvider added in v0.5.0

type DatabaseProvider string

type FileRealmOption

type FileRealmOption struct {
	Basic  BasicAuthConfig  `json:"basic" bson:"basic" envconfig:"CONVOY_BASIC_AUTH_CONFIG"`
	APIKey APIKeyAuthConfig `json:"api_key" envconfig:"CONVOY_API_KEY_CONFIG"`
}

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 JwtRealmOptions added in v0.6.0

type JwtRealmOptions struct {
	Enabled       bool   `json:"enabled" envconfig:"CONVOY_JWT_REALM_ENABLED"`
	Secret        string `json:"secret" envconfig:"CONVOY_JWT_SECRET"`
	Expiry        int    `json:"expiry" envconfig:"CONVOY_JWT_EXPIRY"`
	RefreshSecret string `json:"refresh_secret" envconfig:"CONVOY_JWT_REFRESH_SECRET"`
	RefreshExpiry int    `json:"refresh_expiry" envconfig:"CONVOY_JWT_REFRESH_EXPIRY"`
}

type LimiterConfiguration added in v0.5.0

type LimiterConfiguration struct {
	Type  LimiterProvider           `json:"type" envconfig:"CONVOY_LIMITER_TYPE"`
	Redis RedisLimiterConfiguration `json:"redis"`
}

type LimiterProvider added in v0.5.0

type LimiterProvider string

type LoggerConfiguration

type LoggerConfiguration struct {
	Type      LoggerProvider `json:"type" envconfig:"CONVOY_LOGGER_PROVIDER"`
	ServerLog ServerLogger   `json:"server_log"`
}

type LoggerProvider

type LoggerProvider string

type NativeRealmOptions

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

type NewRelicConfiguration

type NewRelicConfiguration struct {
	AppName                  string `json:"app_name" envconfig:"CONVOY_NEWRELIC_APP_NAME"`
	LicenseKey               string `json:"license_key" envconfig:"CONVOY_NEWRELIC_LICENSE_KEY"`
	ConfigEnabled            bool   `json:"config_enabled" envconfig:"CONVOY_NEWRELIC_CONFIG_ENABLED"`
	DistributedTracerEnabled bool   `json:"distributed_tracer_enabled" envconfig:"CONVOY_NEWRELIC_DISTRIBUTED_TRACER_ENABLED"`
}

type PrometheusConfiguration added in v0.6.0

type PrometheusConfiguration struct {
	Dsn string `json:"dsn" envconfig:"CONVOY_PROM_DSN"`
}

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

type RedisLimiterConfiguration added in v0.5.0

type RedisLimiterConfiguration struct {
	Dsn string `json:"dsn" envconfig:"CONVOY_REDIS_DSN"`
}

type RedisQueueConfiguration

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

type SMTPConfiguration

type SMTPConfiguration struct {
	Provider string `json:"provider" envconfig:"CONVOY_SMTP_PROVIDER"`
	URL      string `json:"url" envconfig:"CONVOY_SMTP_URL"`
	Port     uint32 `json:"port" envconfig:"CONVOY_SMTP_PORT"`
	Username string `json:"username" envconfig:"CONVOY_SMTP_USERNAME"`
	Password string `json:"password" envconfig:"CONVOY_SMTP_PASSWORD"`
	From     string `json:"from" envconfig:"CONVOY_SMTP_FROM"`
	ReplyTo  string `json:"reply-to" envconfig:"CONVOY_SMTP_REPLY_TO"`
}

type SearchConfiguration added in v0.6.0

type SearchConfiguration struct {
	Type      SearchProvider         `json:"type" envconfig:"CONVOY_SEARCH_TYPE"`
	Typesense TypesenseConfiguration `json:"typesense"`
}

type SearchProvider added in v0.6.0

type SearchProvider string

type SentryConfiguration

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

type ServerConfiguration

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

type ServerLogger added in v0.5.0

type ServerLogger struct {
	Level string `json:"level" envconfig:"CONVOY_LOGGER_LEVEL"`
}

type SignatureHeaderProvider

type SignatureHeaderProvider string

func (SignatureHeaderProvider) String

func (s SignatureHeaderProvider) String() string

type StrategyProvider

type StrategyProvider string

type TracerConfiguration

type TracerConfiguration struct {
	Type     TracerProvider        `json:"type" envconfig:"CONVOY_TRACER_PROVIDER"`
	NewRelic NewRelicConfiguration `json:"new_relic"`
}

type TracerProvider

type TracerProvider string

type TypesenseConfiguration added in v0.6.0

type TypesenseConfiguration struct {
	Host   string `json:"host" envconfig:"CONVOY_TYPESENSE_HOST"`
	ApiKey string `json:"api_key" envconfig:"CONVOY_TYPESENSE_API_KEY"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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