Documentation ¶
Index ¶
- Constants
- func IsStringEmpty(s string) bool
- func LoadConfig(p string) error
- func OverrideConfigWithCliFlags(cmd *cobra.Command, cfg *Configuration) error
- func SetServerConfigDefaults(c *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 DefaultStrategyConfiguration
- type ExponentialBackoffStrategyConfiguration
- type FileRealmOption
- type GroupConfig
- type HTTPServerConfiguration
- type LimiterConfiguration
- type LimiterProvider
- type LoggerConfiguration
- type LoggerProvider
- type NativeRealmOptions
- type NewRelicConfiguration
- type QueueConfiguration
- type QueueProvider
- type RedisCacheConfiguration
- type RedisLimiterConfiguration
- type RedisQueueConfiguration
- type SMTPConfiguration
- type SentryConfiguration
- type ServerConfiguration
- type ServerLogger
- type SignatureConfiguration
- type SignatureHeaderProvider
- type StrategyConfiguration
- type StrategyProvider
- type TracerConfiguration
- type TracerProvider
Constants ¶
View Source
const ( MaxResponseSizeKb = 50 // in kilobytes MaxResponseSize = MaxResponseSizeKb * 1024 // in bytes )
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" 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
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 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 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 { RequireAuth bool `json:"require_auth" envconfig:"CONVOY_REQUIRE_AUTH"` File FileRealmOption `json:"file"` Native NativeRealmOptions `json:"native"` }
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"` Sentry SentryConfiguration `json:"sentry"` Queue QueueConfiguration `json:"queue"` Server ServerConfiguration `json:"server"` MaxResponseSize uint64 `json:"max_response_size" envconfig:"CONVOY_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"` Limiter LimiterConfiguration `json:"limiter"` BaseUrl string `json:"base_url" envconfig:"CONVOY_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 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 ExponentialBackoffStrategyConfiguration ¶ added in v0.4.10
type ExponentialBackoffStrategyConfiguration struct {
RetryLimit uint64 `json:"retryLimit" envconfig:"CONVOY_RETRY_LIMIT"`
}
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 GroupConfig ¶
type GroupConfig struct { Strategy StrategyConfiguration `json:"strategy"` Signature SignatureConfiguration `json:"signature"` DisableEndpoint bool `json:"disable_endpoint" envconfig:"CONVOY_DISABLE_ENDPOINT"` ReplayAttacks bool `json:"replay_attacks" envconfig:"CONVOY_REPLAY_ATTACKS"` }
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 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 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 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 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" envconfig:"CONVOY_STRATEGY_TYPE"` Default DefaultStrategyConfiguration `json:"default"` ExponentialBackoff ExponentialBackoffStrategyConfiguration `json:"exponentialBackoff,omitempty"` }
type StrategyProvider ¶
type StrategyProvider string
type TracerConfiguration ¶
type TracerConfiguration struct {
Type TracerProvider `json:"type" envconfig:"CONVOY_TRACER_PROVIDER"`
}
type TracerProvider ¶
type TracerProvider string
Click to show internal directories.
Click to hide internal directories.