config

package
v0.0.0-...-c1d36c6 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPgDeltaNpmVersion = "1.0.0-alpha.22"

DefaultPgDeltaNpmVersion is the npm dist-tag/version used for @supabase/pg-delta when supabase/.temp/pgdelta-version is absent or empty.

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 EffectivePgDeltaNpmVersion

func EffectivePgDeltaNpmVersion(c Config) string

EffectivePgDeltaNpmVersion returns the pg-delta npm version from loaded config, or DefaultPgDeltaNpmVersion when unset (e.g. before Load or empty field).

func GenerateAsymmetricJWT

func GenerateAsymmetricJWT(jwk JWK, claims jwt.Claims) (string, error)

GenerateAsymmetricJWT generates a JWT token signed with the provided JWK private key

func InterpolatePgDeltaScript

func InterpolatePgDeltaScript(c Config, script string) string

InterpolatePgDeltaScript substitutes pg delta npm version placeholders in embedded TS.

func LoadEnvHook

func LoadEnvHook(f reflect.Kind, t reflect.Kind, data any) (any, error)

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

func NewBigIntFromBase64

func NewBigIntFromBase64(n string) (*big.Int, error)

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 any) (any, 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 Algorithm

type Algorithm string
const (
	AlgRS256 Algorithm = "RS256"
	AlgES256 Algorithm = "ES256"
)

func (*Algorithm) UnmarshalText

func (p *Algorithm) 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

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

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) UpdateSigningKeys

func (u *ConfigUpdater) UpdateSigningKeys(ctx context.Context, projectRef string, signingKeys []JWK, filter ...func(string) bool) error

func (*ConfigUpdater) UpdateSslEnforcement

func (u *ConfigUpdater) UpdateSslEnforcement(ctx context.Context, projectRef string, s sslEnforcement, 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"`
	IsAnon bool   `json:"is_anonymous,omitempty"`
	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 JWK

type JWK struct {
	KeyType     string    `toml:"kty" json:"kty"`
	KeyID       string    `toml:"kid,omitempty" json:"kid,omitempty"`
	Use         string    `toml:"use,omitempty" json:"use,omitempty"`
	KeyOps      []string  `toml:"key_ops,omitempty" json:"key_ops,omitempty"`
	Algorithm   Algorithm `toml:"alg,omitempty" json:"alg,omitempty"`
	Extractable *bool     `toml:"ext,omitempty" json:"ext,omitempty"`
	// RSA specific fields
	Modulus  string `toml:"n,omitempty" json:"n,omitempty"`
	Exponent string `toml:"e,omitempty" json:"e,omitempty"`
	// RSA private key fields
	PrivateExponent         string `toml:"d,omitempty" json:"d,omitempty"`
	FirstPrimeFactor        string `toml:"p,omitempty" json:"p,omitempty"`
	SecondPrimeFactor       string `toml:"q,omitempty" json:"q,omitempty"`
	FirstFactorCRTExponent  string `toml:"dp,omitempty" json:"dp,omitempty"`
	SecondFactorCRTExponent string `toml:"dq,omitempty" json:"dq,omitempty"`
	FirstCRTCoefficient     string `toml:"qi,omitempty" json:"qi,omitempty"`
	// EC specific fields
	Curve string `toml:"crv,omitempty" json:"crv,omitempty"`
	X     string `toml:"x,omitempty" json:"x,omitempty"`
	Y     string `toml:"y,omitempty" json:"y,omitempty"`
}

func (JWK) ToPublicJWK

func (j JWK) ToPublicJWK() JWK

ToPublicJWK converts a JWK to a public-only version by removing private key components

type LogflareBackend

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

func (*LogflareBackend) UnmarshalText

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

type OAuthServer

type OAuthServer struct {
	Enabled                  bool   `toml:"enabled" json:"enabled"`
	AllowDynamicRegistration bool   `toml:"allow_dynamic_registration" json:"allow_dynamic_registration"`
	AuthorizationUrlPath     string `toml:"authorization_url_path" json:"authorization_url_path"`
}

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 PgDeltaConfig

type PgDeltaConfig struct {
	Enabled               bool   `toml:"enabled" json:"enabled"`
	DeclarativeSchemaPath string `toml:"declarative_schema_path" json:"declarative_schema_path"`
	FormatOptions         string `toml:"format_options" json:"format_options"`
	// NpmVersion is set from .temp/pgdelta-version during Load (not from TOML).
	NpmVersion string `toml:"-" json:"-"`
}

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 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