Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeOnlyString(fromValue reflect.Value, toValue reflect.Value) (interface{}, error)
- func DecodeStrings(fromValue reflect.Value, toValue reflect.Value) (interface{}, error)
- func GetStructKeys(typ reflect.Type, tag, squashValue string) []string
- func MapLoggingFields(value interface{}) logging.Fields
- func Unmarshal(c *Config) error
- func ValidateMissingRequiredKeys(value interface{}, tag, squashValue string) []string
- type Config
- func (c *Config) AuthEncryptionSecret() []byte
- func (c *Config) BlockstoreAzureParams() (blockparams.Azure, error)
- func (c *Config) BlockstoreGSParams() (blockparams.GS, error)
- func (c *Config) BlockstoreLocalParams() (blockparams.Local, error)
- func (c *Config) BlockstoreS3Params() (blockparams.S3, error)
- func (c *Config) BlockstoreType() string
- func (c *Config) CommittedParams() committed.Params
- func (c *Config) DatabaseParams() (kvparams.Config, error)
- func (c *Config) GetAwsConfig() *aws.Config
- func (c *Config) GetCommittedTierFSParams(adapter block.Adapter) (*pyramidparams.ExtParams, error)
- func (c *Config) IsAuthTypeAPI() bool
- func (c *Config) NewGravelerBackgroundLimiter() ratelimit.Limiter
- func (c *Config) UISnippets() []apiparams.CodeSnippet
- func (c *Config) Validate() error
- type LDAP
- type OIDC
- type OnlyString
- type S3AuthInfo
- type SecureString
- type Strings
Constants ¶
const ( DefaultListenAddress = "0.0.0.0:8000" DefaultLoggingLevel = "INFO" DefaultLoggingAuditLogLevel = "DEBUG" BlockstoreTypeKey = "blockstore.type" )
const ( FieldMaskedValue = "******" FieldMaskedNoValue = "------" )
const UseLocalConfiguration = "local-settings"
UseLocalConfiguration set to true will add defaults that enable a lakeFS run without any other configuration like DB or blockstore.
Variables ¶
var ( ErrBadConfiguration = errors.New("bad configuration") ErrMissingSecretKey = fmt.Errorf("%w: auth.encrypt.secret_key cannot be empty", ErrBadConfiguration) ErrInvalidProportion = fmt.Errorf("%w: total proportion isn't 1.0", ErrBadConfiguration) ErrBadDomainNames = fmt.Errorf("%w: domain names are prefixes", ErrBadConfiguration) ErrMissingRequiredKeys = fmt.Errorf("%w: missing required keys", ErrBadConfiguration) )
var (
ErrMustBeString = errors.New("must be a string")
)
Functions ¶
func DecodeOnlyString ¶ added in v0.65.0
DecodeOnlyString is a mapstructure.HookFuncType that decodes a string value as an OnlyString, but fails on all other values. It is useful to force parsing of a field that can contain just digits as a string, when the leading digit might be 0.
func DecodeStrings ¶ added in v0.40.0
DecodeStrings is a mapstructure.HookFuncType that decodes a single string value or a slice of strings into Strings.
func GetStructKeys ¶ added in v0.40.0
GetStructKeys returns all keys in a nested struct type, taking the name from the tag name or the field name. It handles an additional suffix squashValue like mapstructure does: if present on an embedded struct, name components for that embedded struct should not be included. It does not handle maps, does chase pointers, but does not check for loops in nesting.
func MapLoggingFields ¶ added in v0.50.0
MapLoggingFields returns all logging.Fields formatted based on our configuration keys 'dot.name.key' with associated values. Supports squash, and secret to skip printing out secrets.
func ValidateMissingRequiredKeys ¶ added in v0.48.0
ValidateMissingRequiredKeys returns all keys of value in GetStructKeys format that have an additional required tag set but are unset.
Types ¶
type Config ¶
type Config struct { ListenAddress string `mapstructure:"listen_address"` Actions struct { // ActionsEnabled set to false will block any hook execution Enabled bool `mapstructure:"enabled"` } Logging struct { Format string `mapstructure:"format"` Level string `mapstructure:"level"` Output []string `mapstructure:"output"` FileMaxSizeMB int `mapstructure:"file_max_size_mb"` FilesKeep int `mapstructure:"files_keep"` AuditLogLevel string `mapstructure:"audit_log_level"` // TraceRequestHeaders work only on 'trace' level, default is false as it may log sensitive data to the log TraceRequestHeaders bool `mapstructure:"trace_request_headers"` } Database struct { // DropTables Development flag to delete tables after successful migration to KV DropTables bool `mapstructure:"drop_tables"` // Type Name of the KV Store driver DB implementation which is available according to the kv package Drivers function Type string `mapstructure:"type" validate:"required"` Local *struct { // Path - Local directory path to store the DB files Path string `mapstructure:"path"` // SyncWrites - Sync ensures data written to disk on each write instead of mem cache SyncWrites bool `mapstructure:"sync_writes"` // PrefetchSize - Number of elements to prefetch while iterating PrefetchSize int `mapstructure:"prefetch_size"` // EnableLogging - Enable store and badger (trace only) logging EnableLogging bool `mapstructure:"enable_logging"` } `mapstructure:"local"` Postgres *struct { ConnectionString string `mapstructure:"connection_string"` MaxOpenConnections int32 `mapstructure:"max_open_connections"` MaxIdleConnections int32 `mapstructure:"max_idle_connections"` ConnectionMaxLifetime time.Duration `mapstructure:"connection_max_lifetime"` ScanPageSize int `mapstructure:"scan_page_size"` Metrics bool `mapstructure:"metrics"` } DynamoDB *struct { // The name of the DynamoDB table to be used as KV TableName string `mapstructure:"table_name"` // Maximal number of items per page during scan operation ScanLimit int64 `mapstructure:"scan_limit"` // The endpoint URL of the DynamoDB endpoint // Can be used to redirect to DynamoDB on AWS, local docker etc. Endpoint string `mapstructure:"endpoint"` // AWS connection details - region and credentials // This will override any such details that are already exist in the system // While in general, AWS region and credentials are configured in the system for AWS usage, // these can be used to specify fake values, that cna be used to connect to local DynamoDB, // in case there are no credentials configured in the system // This is a client requirement as described in section 4 in // https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html AwsRegion string `mapstructure:"aws_region"` AwsProfile string `mapstructure:"aws_profile"` AwsAccessKeyID string `mapstructure:"aws_access_key_id"` AwsSecretAccessKey string `mapstructure:"aws_secret_access_key"` } `mapstructure:"dynamodb"` } Auth struct { Cache struct { Enabled bool Size int TTL time.Duration Jitter time.Duration } Encrypt struct { SecretKey SecureString `mapstructure:"secret_key" validate:"required"` } API struct { Endpoint string Token string SupportsInvites bool `mapstructure:"supports_invites"` } LDAP *LDAP OIDC OIDC // LogoutRedirectURL is the URL on which to mount the // server-side logout. LogoutRedirectURL string `mapstructure:"logout_redirect_url"` LoginDuration time.Duration `mapstructure:"login_duration"` UIConfig struct { RBAC string `mapstructure:"rbac"` LoginURL string `mapstructure:"login_url"` LoginFailedMessage string `mapstructure:"login_failed_message"` FallbackLoginURL *string `mapstructure:"fallback_login_url"` FallbackLoginLabel *string `mapstructure:"fallback_login_label"` LoginCookieNames []string `mapstructure:"login_cookie_names"` LogoutURL string `mapstructure:"logout_url"` } `mapstructure:"ui_config"` } Blockstore struct { Type string `mapstructure:"type" validate:"required"` DefaultNamespacePrefix string `mapstructure:"default_namespace_prefix"` Local *struct { Path string `mapstructure:"path"` } S3 *struct { S3AuthInfo `mapstructure:",squash"` Region string `mapstructure:"region"` Endpoint string `mapstructure:"endpoint"` StreamingChunkSize int `mapstructure:"streaming_chunk_size"` StreamingChunkTimeout time.Duration `mapstructure:"streaming_chunk_timeout"` MaxRetries int `mapstructure:"max_retries"` ForcePathStyle bool `mapstructure:"force_path_style"` DiscoverBucketRegion bool `mapstructure:"discover_bucket_region"` SkipVerifyCertificateTestOnly bool `mapstructure:"skip_verify_certificate_test_only"` ServerSideEncryption string `mapstructure:"server_side_encryption"` ServerSideEncryptionKmsKeyID string `mapstructure:"server_side_encryption_kms_key_id"` PreSignedExpiry time.Duration `mapstructure:"pre_signed_expiry"` } `mapstructure:"s3"` Azure *struct { TryTimeout time.Duration `mapstructure:"try_timeout"` StorageAccount string `mapstructure:"storage_account"` StorageAccessKey string `mapstructure:"storage_access_key"` // Deprecated: Value ignored AuthMethod string `mapstructure:"auth_method"` PreSignedExpiry time.Duration `mapstructure:"pre_signed_expiry"` } `mapstructure:"azure"` GS *struct { S3Endpoint string `mapstructure:"s3_endpoint"` CredentialsFile string `mapstructure:"credentials_file"` CredentialsJSON string `mapstructure:"credentials_json"` PreSignedExpiry time.Duration `mapstructure:"pre_signed_expiry"` } `mapstructure:"gs"` } Committed struct { LocalCache struct { SizeBytes int64 `mapstructure:"size_bytes"` Dir string `mapstructure:"dir"` MaxUploadersPerWriter int `mapstructure:"max_uploaders_per_writer"` RangeProportion float64 `mapstructure:"range_proportion"` MetaRangeProportion float64 `mapstructure:"metarange_proportion"` } `mapstructure:"local_cache"` BlockStoragePrefix string `mapstructure:"block_storage_prefix"` Permanent struct { MinRangeSizeBytes uint64 `mapstructure:"min_range_size_bytes"` MaxRangeSizeBytes uint64 `mapstructure:"max_range_size_bytes"` RangeRaggednessEntries float64 `mapstructure:"range_raggedness_entries"` } `mapstructure:"permanent"` SSTable struct { Memory struct { CacheSizeBytes int64 `mapstructure:"cache_size_bytes"` } `mapstructure:"memory"` } } Graveler struct { RepositoryCache struct { Size int `mapstructure:"size"` Expiry time.Duration `mapstructure:"expiry"` Jitter time.Duration `mapstructure:"jitter"` } `mapstructure:"repository_cache"` CommitCache struct { Size int `mapstructure:"size"` Expiry time.Duration `mapstructure:"expiry"` Jitter time.Duration `mapstructure:"jitter"` } `mapstructure:"commit_cache"` Background struct { RateLimit int `mapstructure:"rate_limit"` } `mapstructure:"background"` } `mapstructure:"graveler"` Gateways struct { S3 struct { DomainNames Strings `mapstructure:"domain_name"` Region string `mapstructure:"region"` FallbackURL string `mapstructure:"fallback_url"` } `mapstructure:"s3"` } Stats struct { Enabled bool `mapstructure:"enabled"` Address string `mapstructure:"address"` FlushInterval time.Duration `mapstructure:"flush_interval"` FlushSize int `mapstructure:"flush_size"` Extended bool `mapstructure:"extended"` } `mapstructure:"stats"` EmailSubscription struct { Enabled bool `mapstructure:"enabled"` } `mapstructure:"email_subscription"` Installation struct { FixedID string `mapstructure:"fixed_id"` } `mapstructure:"installation"` Security struct { AuditCheckInterval time.Duration `mapstructure:"audit_check_interval"` AuditCheckURL string `mapstructure:"audit_check_url"` } `mapstructure:"security"` Email struct { SMTPHost string `mapstructure:"smtp_host"` SMTPPort int `mapstructure:"smtp_port"` UseSSL bool `mapstructure:"use_ssl"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` LocalName string `mapstructure:"local_name"` Sender string `mapstructure:"sender"` LimitEveryDuration time.Duration `mapstructure:"limit_every_duration"` Burst int `mapstructure:"burst"` LakefsBaseURL string `mapstructure:"lakefs_base_url"` } `mapstructure:"email"` UI struct { // Enabled - control serving of embedded UI Enabled bool `mapstructure:"enabled"` Snippets []struct { ID string `mapstructure:"id"` Code string `mapstructure:"code"` } `mapstructure:"snippets"` } `mapstructure:"ui"` }
Config - Output struct of configuration, used to validate. If you read a key using a viper accessor rather than accessing a field of this struct, that key will *not* be validated. So don't do that.
func NewLocalConfig ¶ added in v0.82.0
func (*Config) AuthEncryptionSecret ¶ added in v0.89.0
func (*Config) BlockstoreAzureParams ¶ added in v0.89.0
func (c *Config) BlockstoreAzureParams() (blockparams.Azure, error)
func (*Config) BlockstoreGSParams ¶ added in v0.89.0
func (c *Config) BlockstoreGSParams() (blockparams.GS, error)
func (*Config) BlockstoreLocalParams ¶ added in v0.89.0
func (c *Config) BlockstoreLocalParams() (blockparams.Local, error)
func (*Config) BlockstoreS3Params ¶ added in v0.89.0
func (c *Config) BlockstoreS3Params() (blockparams.S3, error)
func (*Config) BlockstoreType ¶ added in v0.89.0
func (*Config) CommittedParams ¶ added in v0.89.0
func (*Config) DatabaseParams ¶ added in v0.89.0
func (*Config) GetAwsConfig ¶
func (*Config) GetCommittedTierFSParams ¶
GetCommittedTierFSParams returns parameters for building a tierFS. Caller must separately build and populate Adapter.
func (*Config) IsAuthTypeAPI ¶ added in v0.63.0
func (*Config) NewGravelerBackgroundLimiter ¶ added in v0.92.0
func (*Config) UISnippets ¶ added in v0.89.0
func (c *Config) UISnippets() []apiparams.CodeSnippet
type LDAP ¶ added in v0.53.0
type LDAP struct { ServerEndpoint string `mapstructure:"server_endpoint"` BindDN string `mapstructure:"bind_dn"` BindPassword string `mapstructure:"bind_password"` DefaultUserGroup string `mapstructure:"default_user_group"` UsernameAttribute string `mapstructure:"username_attribute"` UserBaseDN string `mapstructure:"user_base_dn"` UserFilter string `mapstructure:"user_filter"` }
LDAP holds configuration for authenticating on an LDAP server.
type OIDC ¶ added in v0.69.0
type OIDC struct { Enabled bool `mapstructure:"enabled"` IsDefaultLogin bool `mapstructure:"is_default_login"` // provider details: URL string `mapstructure:"url"` ClientID string `mapstructure:"client_id"` ClientSecret string `mapstructure:"client_secret"` // configure the OIDC authentication flow: CallbackBaseURL string `mapstructure:"callback_base_url"` AuthorizeEndpointQueryParameters map[string]string `mapstructure:"authorize_endpoint_query_parameters"` // configure how users are handled on the lakeFS side: ValidateIDTokenClaims map[string]string `mapstructure:"validate_id_token_claims"` DefaultInitialGroups []string `mapstructure:"default_initial_groups"` InitialGroupsClaimName string `mapstructure:"initial_groups_claim_name"` FriendlyNameClaimName string `mapstructure:"friendly_name_claim_name"` AdditionalScopeClaims []string `mapstructure:"additional_scope_claims"` }
type OnlyString ¶ added in v0.65.0
type OnlyString string
OnlyString is a string that can deserialize only from a string. Use it to prevent YAML configuration reading a number-like string with leading zeros, and then Viper using mapstructure to convert it silently back to a string and losing the leading zeros.
type S3AuthInfo ¶ added in v0.40.0
type S3AuthInfo struct { CredentialsFile string `mapstructure:"credentials_file"` Profile string Credentials *struct { AccessKeyID SecureString `mapstructure:"access_key_id"` // AccessSecretKey is the old name for SecretAccessKey. // // Deprecated: use SecretAccessKey instead. AccessSecretKey SecureString `mapstructure:"access_secret_key"` SecretAccessKey SecureString `mapstructure:"secret_access_key"` SessionToken SecureString `mapstructure:"session_token"` } }
S3AuthInfo holds S3-style authentication.
type SecureString ¶ added in v0.50.0
type SecureString string
func (SecureString) SecureValue ¶ added in v0.62.0
func (s SecureString) SecureValue() string
SecureValue returns the actual value of s as a string.
func (SecureString) String ¶ added in v0.50.0
func (SecureString) String() string
String returns an elided version. It is safe to call for logging.