config

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const ENCRYPTED_PREFIX = "encrypted:"
View Source
const HASHED_PREFIX = "hash:"
View Source
const PRIVATE_KEY_PREFIX = "DOTENV_PRIVATE_KEY"

Variables

View Source
var (
	Images images
)

Functions

func DecryptSecretHookFunc

func DecryptSecretHookFunc(hashKey string) mapstructure.DecodeHookFunc

func LoadEnvHook

func LoadEnvHook(f reflect.Kind, t reflect.Kind, data interface{}) (interface{}, error)

LoadEnvHook is a mapstructure decode hook that loads environment variables from strings formatted as env(VAR_NAME).

func NewConfig

func NewConfig(editors ...ConfigEditor) config

func NewPathBuilder

func NewPathBuilder(configPath string) pathBuilder

func ToTomlBytes

func ToTomlBytes(config any) ([]byte, error)

func ValOrDefault

func ValOrDefault[T any](v nullable.Nullable[T], def T) T

func ValidateBucketName

func ValidateBucketName(name string) error

func ValidateFunctionSlug

func ValidateFunctionSlug(slug string) error

func ValidateFunctionsHook

func ValidateFunctionsHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)

ValidateFunctionsHook is a mapstructure decode hook that validates the functions config format.

func VersionCompare

func VersionCompare(a, b string) int

Types

type AddressFamily

type AddressFamily string
const (
	AddressIPv6 AddressFamily = "IPv6"
	AddressIPv4 AddressFamily = "IPv4"
)

func (*AddressFamily) UnmarshalText

func (f *AddressFamily) UnmarshalText(text []byte) error

type BucketConfig

type BucketConfig map[string]bucket

type CaptchaProvider

type CaptchaProvider string
const (
	HCaptchaProvider  CaptchaProvider = "hcaptcha"
	TurnstileProvider CaptchaProvider = "turnstile"
)

func (*CaptchaProvider) UnmarshalText

func (p *CaptchaProvider) UnmarshalText(text []byte) error

type Config added in v1.0.4

type Config *config

type ConfigEditor

type ConfigEditor func(Config)

func WithHostname

func WithHostname(hostname string) ConfigEditor

type ConfigUpdater

type ConfigUpdater struct {
	// contains filtered or unexported fields
}

func NewConfigUpdater

func NewConfigUpdater(client v1API.ClientWithResponses) ConfigUpdater

func (*ConfigUpdater) UpdateApiConfig

func (u *ConfigUpdater) UpdateApiConfig(ctx context.Context, projectRef string, c api, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateAuthConfig

func (u *ConfigUpdater) UpdateAuthConfig(ctx context.Context, projectRef string, c auth, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateDbConfig

func (u *ConfigUpdater) UpdateDbConfig(ctx context.Context, projectRef string, c db, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateDbNetworkRestrictionsConfig added in v1.0.6

func (u *ConfigUpdater) UpdateDbNetworkRestrictionsConfig(ctx context.Context, projectRef string, n networkRestrictions, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateDbSettingsConfig

func (u *ConfigUpdater) UpdateDbSettingsConfig(ctx context.Context, projectRef string, s settings, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateExperimentalConfig

func (u *ConfigUpdater) UpdateExperimentalConfig(ctx context.Context, projectRef string, exp experimental, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateRemoteConfig

func (u *ConfigUpdater) UpdateRemoteConfig(ctx context.Context, remote baseConfig, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateStorageConfig

func (u *ConfigUpdater) UpdateStorageConfig(ctx context.Context, projectRef string, c storage, filter ...func(string) bool) error

type CustomClaims

type CustomClaims struct {
	// Overrides Issuer to maintain json order when marshalling
	Issuer string `json:"iss,omitempty"`
	Ref    string `json:"ref,omitempty"`
	Role   string `json:"role"`
	jwt.RegisteredClaims
}

func (CustomClaims) NewToken

func (c CustomClaims) NewToken() *jwt.Token

type FunctionConfig

type FunctionConfig map[string]function

We follow these rules when adding new config:

  1. Update init_config.toml (and init_config.test.toml) with the new key, default value, and comments to explain usage.
  2. Update config struct with new field and toml tag (spelled in snake_case).
  3. Add custom field validations to LoadConfigFS function for eg. integer range checks.

If you are adding new user defined secrets, such as OAuth provider secret, the default value in init_config.toml should be an env var substitution. For example,

> secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"

Default values for internal configs should be added to `var Config` initializer.

type Glob

type Glob []string

func (Glob) Files

func (g Glob) Files(fsys fs.FS) ([]string, error)

Match the glob patterns in the given FS to get a deduplicated array of all migrations files to apply in the declared order.

type LogflareBackend

type LogflareBackend string
const (
	LogflarePostgres LogflareBackend = "postgres"
	LogflareBigQuery LogflareBackend = "bigquery"
)

func (*LogflareBackend) UnmarshalText

func (b *LogflareBackend) UnmarshalText(text []byte) error

type PasswordRequirements

type PasswordRequirements string
const (
	NoRequirements                 PasswordRequirements = ""
	LettersDigits                  PasswordRequirements = "letters_digits"
	LowerUpperLettersDigits        PasswordRequirements = "lower_upper_letters_digits"
	LowerUpperLettersDigitsSymbols PasswordRequirements = "lower_upper_letters_digits_symbols"
)

func (*PasswordRequirements) UnmarshalText

func (r *PasswordRequirements) UnmarshalText(text []byte) error

type PoolMode

type PoolMode string
const (
	TransactionMode PoolMode = "transaction"
	SessionMode     PoolMode = "session"
)

func (*PoolMode) UnmarshalText

func (m *PoolMode) UnmarshalText(text []byte) error

type RequestPolicy

type RequestPolicy string
const (
	PolicyPerWorker RequestPolicy = "per_worker"
	PolicyOneshot   RequestPolicy = "oneshot"
)

func (*RequestPolicy) UnmarshalText

func (p *RequestPolicy) UnmarshalText(text []byte) error

type Secret

type Secret struct {
	Value  string
	SHA256 string
}

func (*Secret) Decrypt

func (s *Secret) Decrypt(keys []string) error

func (Secret) MarshalText

func (s Secret) MarshalText() (text []byte, err error)

type SecretsConfig

type SecretsConfig map[string]Secret

We follow these rules when adding new config:

  1. Update init_config.toml (and init_config.test.toml) with the new key, default value, and comments to explain usage.
  2. Update config struct with new field and toml tag (spelled in snake_case).
  3. Add custom field validations to LoadConfigFS function for eg. integer range checks.

If you are adding new user defined secrets, such as OAuth provider secret, the default value in init_config.toml should be an env var substitution. For example,

> secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"

Default values for internal configs should be added to `var Config` initializer.

type SessionReplicationRole

type SessionReplicationRole string
const (
	SessionReplicationRoleOrigin  SessionReplicationRole = "origin"
	SessionReplicationRoleReplica SessionReplicationRole = "replica"
	SessionReplicationRoleLocal   SessionReplicationRole = "local"
)

func (*SessionReplicationRole) UnmarshalText

func (r *SessionReplicationRole) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL