Documentation ¶
Index ¶
- Constants
- Variables
- func IsStringEmpty(s string) bool
- func LoadConfig(p string) error
- func Override(newCfg *Configuration) error
- type APIKeyAuth
- type APIKeyAuthConfig
- type AnalyticsConfiguration
- 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 OnPremStorage
- type PrometheusConfiguration
- type QueueConfiguration
- type QueueProvider
- type RedisCacheConfiguration
- type RedisLimiterConfiguration
- type RedisQueueConfiguration
- type S3Storage
- type SMTPConfiguration
- type SearchConfiguration
- type SearchProvider
- type ServerConfiguration
- type SignatureHeaderProvider
- type StoragePolicyConfiguration
- 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", }, }, Logger: LoggerConfiguration{ Level: "error", }, Analytics: AnalyticsConfiguration{ IsEnabled: true, }, StoragePolicy: StoragePolicyConfiguration{ Type: "on-prem", OnPrem: OnPremStorage{ Path: convoy.DefaultOnPremDir, }, }, Auth: AuthConfiguration{ IsSignupEnabled: true, }, }
Functions ¶
func IsStringEmpty ¶
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 ¶
func Override(newCfg *Configuration) error
Types ¶
type APIKeyAuth ¶
type APIKeyAuthConfig ¶
type APIKeyAuthConfig []APIKeyAuth
func (*APIKeyAuthConfig) Decode ¶
func (a *APIKeyAuthConfig) Decode(value string) error
Decode loads in config from an env var named `CONVOY_API_KEY_CONFIG`
type AnalyticsConfiguration ¶
type AnalyticsConfiguration struct {
IsEnabled bool `json:"enabled" envconfig:"CONVOY_ANALYTICS_ENABLED"`
}
type AuthConfiguration ¶
type AuthConfiguration struct { File FileRealmOption `json:"file"` Native NativeRealmOptions `json:"native"` Jwt JwtRealmOptions `json:"jwt"` IsSignupEnabled bool `json:"is_signup_enabled"` }
type AuthProvider ¶
type AuthProvider string
type BasicAuthConfig ¶
type BasicAuthConfig []BasicAuth
func (*BasicAuthConfig) Decode ¶
func (b *BasicAuthConfig) Decode(value string) error
Decode loads in config from an env var named `CONVOY_BASIC_AUTH_CONFIG`
type CacheConfiguration ¶
type CacheConfiguration struct { Type CacheProvider `json:"type" envconfig:"CONVOY_CACHE_PROVIDER"` Redis RedisCacheConfiguration `json:"redis"` }
type CacheProvider ¶
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"` Logger LoggerConfiguration `json:"logger"` Tracer TracerConfiguration `json:"tracer"` Cache CacheConfiguration `json:"cache"` Limiter LimiterConfiguration `json:"limiter"` Host string `json:"host" envconfig:"CONVOY_HOST"` CustomDomainSuffix string `json:"custom_domain_suffix" envconfig:"CONVOY_CUSTOM_DOMAIN_SUFFIX"` Search SearchConfiguration `json:"search"` FeatureFlag FeatureFlagConfiguration `json:"feature_flag"` Analytics AnalyticsConfiguration `json:"analytics"` StoragePolicy StoragePolicyConfiguration `json:"storage_policy"` }
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 ¶
type DatabaseProvider string
type FeatureFlagConfiguration ¶
type FeatureFlagConfiguration struct { Type FeatureFlagProvider `json:"type" envconfig:"CONVOY_FEATURE_FLAG_TYPE"` Flipt FliptConfiguration `json:"flipt"` }
type FeatureFlagProvider ¶
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 ¶
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"` DomainPort uint32 `json:"domain_port" envconfig:"DOMAIN_PORT"` HttpProxy string `json:"proxy" envconfig:"HTTP_PROXY"` }
type JwtRealmOptions ¶
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 ¶
type LimiterConfiguration struct { Type LimiterProvider `json:"type" envconfig:"CONVOY_LIMITER_TYPE"` Redis RedisLimiterConfiguration `json:"redis"` }
type LimiterProvider ¶
type LimiterProvider string
type LoggerConfiguration ¶
type LoggerConfiguration struct {
Level string `json:"level" envconfig:"CONVOY_LOGGER_LEVEL"`
}
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 OnPremStorage ¶
type OnPremStorage struct {
Path string `json:"path" envconfig:"CONVOY_STORAGE_PREM_PATH"`
}
type PrometheusConfiguration ¶
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 ¶
type RedisCacheConfiguration struct {
Dsn string `json:"dsn" envconfig:"CONVOY_REDIS_DSN"`
}
type RedisLimiterConfiguration ¶
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 S3Storage ¶
type S3Storage struct { Bucket string `json:"bucket" envconfig:"CONVOY_STORAGE_AWS_BUCKET"` AccessKey string `json:"access_key" envconfig:"CONVOY_STORAGE_AWS_ACCESS_KEY"` SecretKey string `json:"secret_key" envconfig:"CONVOY_STORAGE_AWS_SECRET_KEY"` Region string `json:"region" envconfig:"CONVOY_STORAGE_AWS_REGION"` SessionToken string `json:"session_token" envconfig:"CONVOY_STORAGE_AWS_SESSION_TOKEN"` Endpoint string `json:"endpoint" envconfig:"CONVOY_STORAGE_AWS_ENDPOINT"` }
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 ¶
type SearchConfiguration struct { Type SearchProvider `json:"type" envconfig:"CONVOY_SEARCH_TYPE"` Typesense TypesenseConfiguration `json:"typesense"` }
type SearchProvider ¶
type SearchProvider string
type ServerConfiguration ¶
type ServerConfiguration struct {
HTTP HTTPServerConfiguration `json:"http"`
}
type SignatureHeaderProvider ¶
type SignatureHeaderProvider string
func (SignatureHeaderProvider) String ¶
func (s SignatureHeaderProvider) String() string
type StoragePolicyConfiguration ¶
type StoragePolicyConfiguration struct { Type string `json:"type" envconfig:"CONVOY_STORAGE_POLICY_TYPE"` S3 S3Storage `json:"s3"` OnPrem OnPremStorage `json:"on_prem"` }
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 ¶
Click to show internal directories.
Click to hide internal directories.