Documentation ¶
Index ¶
- Constants
- Variables
- func IsStringEmpty(s string) bool
- func LoadConfig(p string) error
- func Override(newCfg *Configuration) error
- type APIKeyAuth
- type APIKeyAuthConfig
- type AuthConfiguration
- type AuthProvider
- type BasicAuth
- type BasicAuthConfig
- type CacheConfiguration
- type CacheProvider
- type Configuration
- type DatabaseConfiguration
- type DatabaseProvider
- type FeatureFlagConfiguration
- type FeatureFlagProvider
- type FileRealmOption
- type FliptConfiguration
- type HTTPServerConfiguration
- type JwtRealmOptions
- type LimiterConfiguration
- type LimiterProvider
- type LoggerConfiguration
- type LoggerProvider
- type NativeRealmOptions
- type NewRelicConfiguration
- type PrometheusConfiguration
- type QueueConfiguration
- type QueueProvider
- type RedisCacheConfiguration
- type RedisLimiterConfiguration
- type RedisQueueConfiguration
- type SMTPConfiguration
- type SearchConfiguration
- type SearchProvider
- type ServerConfiguration
- type ServerLogger
- type SignatureHeaderProvider
- type StrategyProvider
- type TracerConfiguration
- type TracerProvider
- type TypesenseConfiguration
Constants ¶
View Source
const ( MaxResponseSizeKb = 50 // in kilobytes MaxResponseSize = MaxResponseSizeKb * 1024 // in bytes MaxRequestSize = MaxResponseSize DefaultHost = "localhost:5005" )
View Source
const ( DevelopmentEnvironment string = "development" OSSEnvironment string = "oss" )
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" )
Variables ¶
View Source
var DefaultConfiguration = Configuration{ Host: DefaultHost, Environment: OSSEnvironment, MaxResponseSize: MaxResponseSize, Server: ServerConfiguration{ HTTP: HTTPServerConfiguration{ SSL: false, Port: 5005, WorkerPort: 5006, }, }, Database: DatabaseConfiguration{ Type: MongodbDatabaseProvider, Dsn: "mongodb://localhost:27017/convoy", }, Queue: QueueConfiguration{ Type: RedisQueueProvider, Redis: RedisQueueConfiguration{ Dsn: "redis://localhost:6378", }, }, }
Functions ¶
func IsStringEmpty ¶ added in v0.5.0
IsStringEmpty checks if the given string s is empty or not
func LoadConfig ¶
LoadConfig is used to load the configuration from either the json config file or the environment variables.
func Override ¶ added in v0.6.2
func Override(newCfg *Configuration) error
Types ¶
type APIKeyAuth ¶
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 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"` 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"` 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"` FeatureFlag FeatureFlagConfiguration `json:"feature_flag"` }
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 FeatureFlagConfiguration ¶ added in v0.7.0
type FeatureFlagConfiguration struct { Type FeatureFlagProvider `json:"type" envconfig:"CONVOY_FEATURE_FLAG_TYPE"` Flipt FliptConfiguration `json:"flipt"` }
type FeatureFlagProvider ¶ added in v0.7.0
type FeatureFlagProvider 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 FliptConfiguration ¶ added in v0.7.0
type FliptConfiguration struct {
Host string `json:"host" envconfig:"CONVOY_FLIPT_HOST"`
}
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"` SocketPort uint32 `json:"socket_port" envconfig:"SOCKET_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 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
Click to show internal directories.
Click to hide internal directories.