Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidDatabaseType = errors.New("not a valid DatabaseType")
var ErrInvalidEmailProvider = errors.New("not a valid EmailProvider")
var ErrInvalidLogMode = errors.New("not a valid LogMode")
var ErrInvalidRateLimiterType = errors.New("not a valid RateLimiterType")
var ErrInvalidUploadDriver = errors.New("not a valid UploadDriver")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Logging struct {
Mode LogMode `yaml:"mode" mapstructure:"mode"`
} `yaml:"logging" mapstructure:"logging"`
Frontend struct {
AppURL string `mapstructure:"app_url" yaml:"app_url"`
} `mapstructure:"frontend" yaml:"frontend"`
Database struct {
DatabaseType DatabaseType `yaml:"database_type" mapstructure:"database_type"`
Postgres struct {
DSN string `yaml:"dsn" mapstructure:"dsn"`
LogQueries bool `yaml:"log_queries" mapstructure:"log_queries"`
// How much timeout should be used to run queries agains the db or the
// context dies
QueryTimeout time.Duration `yaml:"query_timeout" mapstructure:"query_timeout"`
} `yaml:"postgres" mapstructure:"postgres"`
Redis struct {
DSN string `yaml:"dsn" mapstructure:"dsn"`
} `yaml:"redis" mapstructure:"redis"`
} `yaml:"database" mapstructure:"database"`
Otel struct {
Endpoint string `yaml:"endpoint" mapstructure:"endpoint"`
UseTLS bool `yaml:"use_tls" mapstructure:"use_tls"`
Headers string `yaml:"headers" mapstructure:"headers"`
IsEnabled bool `yaml:"is_enabled" mapstructure:"is_enabled"`
} `yaml:"otel" mapstructure:"otel"`
HTTP HTTPConfig `yaml:"http" mapstructure:"http"`
Billing struct {
Stripe struct {
APIKey string `yaml:"api_key" mapstructure:"api_key"`
WebhookSecret string `yaml:"webhook_secret" mapstructure:"webhook_secret"`
} `yaml:"stripe" mapstructure:"stripe"`
// If stripe is not enabled, then fake ids can be used in the
// plans table really
// Ideally self hosted users will want to disable this
IsEnabled bool `yaml:"is_enabled" mapstructure:"is_enabled"`
TrialDays int64 `yaml:"trial_days" mapstructure:"trial_days"`
// Newly created workspaces will have this plan automatically
// applied upon creation
DefaultPlanReference string `yaml:"default_plan_reference" mapstructure:"default_plan_reference"`
} `yaml:"billing" mapstructure:"billing"`
Secrets struct {
ClientTimeout time.Duration `yaml:"client_timeout" mapstructure:"client_timeout"`
Provider secret.SecretProvider `yaml:"provider" mapstructure:"provider"`
Vault struct {
Address string `yaml:"address" mapstructure:"address"`
Token string `yaml:"token" mapstructure:"token"`
Path string `yaml:"path" mapstructure:"path"`
} `yaml:"vault" mapstructure:"vault"`
Infisical struct {
ClientID string `yaml:"client_id" mapstructure:"client_id"`
ClientSecret string `yaml:"client_secret" mapstructure:"client_secret"`
SiteURL string `yaml:"site_url" mapstructure:"site_url"`
ProjectID string `yaml:"project_id" mapstructure:"project_id"`
Environment string `yaml:"environment" mapstructure:"environment"`
} `yaml:"infisical" mapstructure:"infisical"`
AES struct {
Key string `yaml:"key" mapstructure:"key"`
} `yaml:"aes" mapstructure:"aes"`
// Merge secrets/key for s3 and this?
SecretsManager struct {
Region string `yaml:"region" mapstructure:"region"`
AccessSecret string `yaml:"access_secret" mapstructure:"access_secret"`
AccessKey string `yaml:"access_key" mapstructure:"access_key"`
Endpoint string `yaml:"endpoint" mapstructure:"endpoint"`
} `yaml:"secrets_manager" mapstructure:"secrets_manager"`
} `yaml:"secrets" mapstructure:"secrets"`
APIKey struct {
HashSecret string `mapstructure:"hash_secret" yaml:"hash_secret"`
} `mapstructure:"api_key" yaml:"api_key"`
Uploader struct {
Driver UploadDriver `yaml:"driver" mapstructure:"driver"`
MaxUploadSize int64 `yaml:"max_upload_size" mapstructure:"max_upload_size"`
S3 struct {
AccessKey string `yaml:"access_key" mapstructure:"access_key"`
AccessSecret string `yaml:"access_secret" mapstructure:"access_secret"`
Region string `yaml:"region" mapstructure:"region"`
Endpoint string `yaml:"endpoint" mapstructure:"endpoint"`
LogOperations bool `yaml:"log_operations" mapstructure:"log_operations"`
Bucket string `yaml:"bucket" mapstructure:"bucket"`
DeckBucket string `yaml:"deck_bucket" mapstructure:"deck_bucket"`
// Enabled by default but you can disable this if running
// your own internal Minio or something
UseTLS bool `yaml:"use_tls" mapstructure:"use_tls"`
CloudflareBucketDomain string `yaml:"cloudflare_bucket_domain" mapstructure:"cloudflare_bucket_domain"`
CloudflareDeckBucketDomain string `yaml:"cloudflare_deck_bucket_domain" mapstructure:"cloudflare_deck_bucket_domain"`
} `yaml:"s3" mapstructure:"s3"`
} `yaml:"uploader" mapstructure:"uploader"`
Email struct {
Provider EmailProvider `mapstructure:"provider" yaml:"provider"`
Sender malak.Email `mapstructure:"sender" yaml:"sender"`
SenderName string `mapstructure:"sender_name" yaml:"sender_name"`
SMTP struct {
Host string `mapstructure:"host" yaml:"host"`
Port int `mapstructure:"port" yaml:"port"`
Username string `mapstructure:"username" yaml:"username"`
Password string `mapstructure:"password" yaml:"password"`
UseTLS bool `yaml:"use_tls" mapstructure:"use_tls"`
} `mapstructure:"smtp" yaml:"smtp"`
Resend struct {
APIKey string `mapstructure:"api_key" yaml:"api_key"`
WebhookSecret string `mapstructure:"webhook_secret" yaml:"webhook_secret"`
} `mapstructure:"resend" yaml:"resend"`
} `mapstructure:"email" yaml:"email"`
Auth struct {
Google struct {
ClientID string `yaml:"client_id" mapstructure:"client_id"`
ClientSecret string `yaml:"client_secret" mapstructure:"client_secret"`
RedirectURI string `yaml:"redirect_uri" mapstructure:"redirect_uri"`
Scopes []string `yaml:"scopes" mapstructure:"scopes"`
IsEnabled bool `yaml:"is_enabled" mapstructure:"is_enabled"`
} `yaml:"google" mapstructure:"google"`
JWT struct {
Key string `yaml:"key" mapstructure:"key"`
} `yaml:"jwt" mapstructure:"jwt"`
} `yaml:"auth" mapstructure:"auth"`
Analytics struct {
// We do not want to embed this into the binary.
// 1.) Can bloat the binary by 65MB.
// 2.) Can lead to discussions about supply chain issues
//
// Better to stay clear and let people load in their data themselves
// We will add the files to the docker image and periodically update it just for simplicity sake
// but you do not have to use them
//
// people can always mount volumes themselves and use their own files
MaxMindCountryDB string `json:"max_mind_country_db,omitempty" yaml:"max_mind_country_db" mapstructure:"max_mind_country_db"`
MaxMindCityDB string `json:"max_mind_city_db,omitempty" yaml:"max_mind_city_db" mapstructure:"max_mind_city_db"`
} `json:"analytics,omitempty" yaml:"analytics" mapstructure:"analytics"`
}
type DatabaseType ¶
type DatabaseType string
Only Postgres for now. Later on we can add support for sqlite3 ENUM(postgres)
const ( // DatabaseTypePostgres is a DatabaseType of type postgres. DatabaseTypePostgres DatabaseType = "postgres" )
func ParseDatabaseType ¶
func ParseDatabaseType(name string) (DatabaseType, error)
ParseDatabaseType attempts to convert a string to a DatabaseType.
func (DatabaseType) IsValid ¶
func (x DatabaseType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (DatabaseType) String ¶
func (x DatabaseType) String() string
String implements the Stringer interface.
type EmailProvider ¶
type EmailProvider string
ENUM(smtp,resend,sendgrid)
const ( // EmailProviderSmtp is a EmailProvider of type smtp. EmailProviderSmtp EmailProvider = "smtp" // EmailProviderResend is a EmailProvider of type resend. EmailProviderResend EmailProvider = "resend" // EmailProviderSendgrid is a EmailProvider of type sendgrid. EmailProviderSendgrid EmailProvider = "sendgrid" )
func ParseEmailProvider ¶
func ParseEmailProvider(name string) (EmailProvider, error)
ParseEmailProvider attempts to convert a string to a EmailProvider.
func (EmailProvider) IsValid ¶
func (x EmailProvider) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (EmailProvider) String ¶
func (x EmailProvider) String() string
String implements the Stringer interface.
type HTTPConfig ¶ added in v0.9.3
type HTTPConfig struct {
Port int `yaml:"port" mapstructure:"port"`
RateLimit struct {
// If redis, you have to configure the redis struct in the database field
Type RateLimiterType `yaml:"type" mapstructure:"type"`
IsEnabled bool `yaml:"is_enabled" mapstructure:"is_enabled"`
RequestsPerMinute uint64 `yaml:"requests_per_minute" mapstructure:"requests_per_minute"`
BurstInterval time.Duration `yaml:"burst_interval" mapstructure:"burst_interval"`
} `yaml:"rate_limit" mapstructure:"rate_limit"`
Swagger struct {
Port int `mapstructure:"port" yaml:"port"`
UIEnabled bool `mapstructure:"ui_enabled" yaml:"ui_enabled"`
} `mapstructure:"swagger" yaml:"swagger"`
Metrics struct {
Enabled bool `mapstructure:"enabled" yaml:"enabled"`
Username string `mapstructure:"username" yaml:"username"`
Password string `mapstructure:"password" yaml:"password"`
} `mapstructure:"metrics" yaml:"metrics"`
}
type LogMode ¶
type LogMode string
ENUM(prod,dev)
func ParseLogMode ¶
ParseLogMode attempts to convert a string to a LogMode.
type RateLimiterType ¶
type RateLimiterType string
ENUM(memory) TODO(adelowo): add Redis support?
const ( // RateLimiterTypeMemory is a RateLimiterType of type memory. RateLimiterTypeMemory RateLimiterType = "memory" )
func ParseRateLimiterType ¶
func ParseRateLimiterType(name string) (RateLimiterType, error)
ParseRateLimiterType attempts to convert a string to a RateLimiterType.
func (RateLimiterType) IsValid ¶
func (x RateLimiterType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (RateLimiterType) String ¶
func (x RateLimiterType) String() string
String implements the Stringer interface.
type UploadDriver ¶
type UploadDriver string
ENUM(s3)
const ( // UploadDriverS3 is a UploadDriver of type s3. UploadDriverS3 UploadDriver = "s3" )
func ParseUploadDriver ¶
func ParseUploadDriver(name string) (UploadDriver, error)
ParseUploadDriver attempts to convert a string to a UploadDriver.
func (UploadDriver) IsValid ¶
func (x UploadDriver) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (UploadDriver) String ¶
func (x UploadDriver) String() string
String implements the Stringer interface.