Documentation ¶
Index ¶
- Constants
- Variables
- func Aqua(str string) string
- func AssertDockerIsRunning() error
- func AssertIsLinkedFS(fsys afero.Fs) error
- func AssertSupabaseCliIsSetUpFS(fsys afero.Fs) error
- func AssertSupabaseDbIsRunning() error
- func Bold(str string) string
- func DockerAddFile(ctx context.Context, container string, fileName string, content []byte) error
- func DockerExec(ctx context.Context, container string, cmd []string) (io.Reader, error)
- func DockerExecOnce(ctx context.Context, container string, env []string, cmd []string) (string, error)
- func DockerImagePullWithRetry(ctx context.Context, image string, retries int) (io.ReadCloser, error)
- func DockerPullImageIfNotCached(ctx context.Context, imageName string) error
- func DockerRemoveAll(ctx context.Context, netId string)
- func DockerRemoveContainers(ctx context.Context, containers []string)
- func DockerRun(ctx context.Context, name string, config *container.Config, ...) (io.Reader, error)
- func DockerRunOnce(ctx context.Context, image string, env []string, cmd []string) (string, error)
- func GetCurrentBranchFS(fsys afero.Fs) (string, error)
- func GetCurrentTimestamp() string
- func GetDenoPath() (string, error)
- func GetGitRoot(fsys afero.Fs) (*string, error)
- func GetProjectRoot(fsys afero.Fs) (string, error)
- func GetRegistryImageUrl(imageName string) string
- func GetSupabase() *supabase.ClientWithResponses
- func GetSupabaseAPIHost() string
- func GetSupabaseDashboardURL() string
- func GetSupabaseDbHost(projectRef string) string
- func GetSupabaseHost(projectRef string) string
- func InstallOrUpgradeDeno(ctx context.Context, fsys afero.Fs) error
- func IsBranchNameReserved(branch string) bool
- func LoadAccessToken() (string, error)
- func LoadAccessTokenFS(fsys afero.Fs) (string, error)
- func LoadConfig() error
- func LoadConfigFS(fsys afero.Fs) error
- func LoadProjectRef(fsys afero.Fs) (string, error)
- func MkdirIfNotExist(path string) error
- func MkdirIfNotExistFS(fsys afero.Fs, path string) error
- func NewDocker() *client.Client
- func NewError(s string) error
- func ProcessDiffOutput(p Program, out io.Reader) ([]byte, error)
- func ProcessPsqlOutput(out io.Reader, p Program) error
- func ProcessPullOutput(out io.ReadCloser, p Program) error
- func ResolveCNAME(ctx context.Context, host string) (string, error)
- func ShowStatus()
- func ValidateFunctionSlug(slug string) error
- func WithTraceContext(ctx context.Context) context.Context
- func WriteConfig(fsys afero.Fs, test bool) error
- type DiffDependencies
- type DiffEntry
- type EnumFlag
- type Program
- type ProgressMsg
- type PromptItem
- type PsqlMsg
- type StatusMsg
Constants ¶
View Source
const ( Pg13Image = "supabase/postgres:13.3.0" Pg14Image = "supabase/postgres:14.1.0.71" // Append to ServiceImages when adding new dependencies below KongImage = "library/kong:2.8.1" InbucketImage = "inbucket/inbucket:3.0.3" PostgrestImage = "postgrest/postgrest:v9.0.1.20220717" DifferImage = "supabase/pgadmin-schema-diff:cli-0.0.5" MigraImage = "djrobstep/migra:3.0.1621480950" PgmetaImage = "supabase/postgres-meta:v0.50.2" StudioImage = "supabase/studio:v0.1.0" DenoRelayImage = "supabase/deno-relay:v1.2.4" // Update initial schemas in internal/utils/templates/initial_schemas when // updating any one of these. GotrueImage = "supabase/gotrue:v2.15.3" RealtimeImage = "supabase/realtime:v0.22.7" StorageImage = "supabase/storage-api:v0.20.1" )
View Source
const ( ShadowDbName = "supabase_shadow" // https://dba.stackexchange.com/a/11895 // Args: dbname TerminateDbSqlFmt = `` /* 244-byte string literal not displayed */ AnonKey = "" /* 131-byte string literal not displayed */ ServiceRoleKey = "" /* 141-byte string literal not displayed */ JWTSecret = "super-secret-jwt-token-with-at-least-32-characters-long" ConfigPath = "supabase/config.toml" ProjectRefPath = "supabase/.temp/project-ref" RemoteDbPath = "supabase/.temp/remote-db-url" CurrBranchPath = "supabase/.branches/_current_branch" MigrationsDir = "supabase/migrations" FunctionsDir = "supabase/functions" DbTestsDir = "supabase/tests" SeedDataPath = "supabase/seed.sql" )
Variables ¶
View Source
var ( DbImage string NetId string DbId string KongId string GotrueId string InbucketId string RealtimeId string RestId string StorageId string DifferId string PgmetaId string StudioId string DenoRelayId string InitialSchemaSql string )
View Source
var ( // pg_dumpall --globals-only --no-role-passwords --dbname $DB_URL \ // | sed '/^CREATE ROLE postgres;/d' \ // | sed '/^ALTER ROLE postgres WITH /d' \ // | sed "/^ALTER ROLE .* WITH .* LOGIN /s/;$/ PASSWORD 'postgres';/" //go:embed templates/globals.sql GlobalsSql string AccessTokenPattern = regexp.MustCompile(`^sbp_[a-f0-9]{40}$`) ProjectRefPattern = regexp.MustCompile(`^[a-z]{20}$`) PostgresUrlPattern = regexp.MustCompile(`^postgres(?:ql)?:\/\/postgres:(.*)@(.+)\/postgres$`) MigrateFilePattern = regexp.MustCompile(`([0-9]+)_.*\.sql`) BranchNamePattern = regexp.MustCompile(`[[:word:]-]+`) FuncSlugPattern = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_-]*$`) // These schemas are ignored from schema diffs InternalSchemas = []string{ "auth", "extensions", "graphql", "graphql_public", "pgbouncer", "pgsodium", "pgsodium_masks", "realtime", "storage", "supabase_functions", "supabase_migrations", "pg_catalog", "pg_toast", "information_schema", } )
View Source
var Config config
View Source
var (
DenoPathOverride string
)
Used by unit tests
View Source
var Docker = NewDocker()
View Source
var RegionMap = map[string]string{
"ap-northeast-1": "Northeast Asia (Tokyo)",
"ap-northeast-2": "Northeast Asia (Seoul)",
"ap-south-1": "South Asia (Mumbai)",
"ap-southeast-1": "Southeast Asia (Singapore)",
"ap-southeast-2": "Oceania (Sydney)",
"ca-central-1": "Canada (Central)",
"eu-central-1": "Central EU (Frankfurt)",
"eu-west-1": "West EU (Ireland)",
"eu-west-2": "West EU (London)",
"sa-east-1": "South America (São Paulo)",
"us-east-1": "East US (North Virginia)",
"us-west-1": "West US (North California)",
}
View Source
var ServiceImages = []string{ GotrueImage, RealtimeImage, StorageImage, KongImage, InbucketImage, PostgrestImage, DifferImage, MigraImage, PgmetaImage, StudioImage, DenoRelayImage, }
Functions ¶
func AssertDockerIsRunning ¶
func AssertDockerIsRunning() error
func AssertIsLinkedFS ¶ added in v0.32.0
func AssertSupabaseCliIsSetUpFS ¶ added in v0.32.0
func AssertSupabaseDbIsRunning ¶ added in v0.33.1
func AssertSupabaseDbIsRunning() error
func DockerAddFile ¶ added in v0.28.2
func DockerExec ¶
func DockerExecOnce ¶ added in v0.37.0
func DockerExecOnce(ctx context.Context, container string, env []string, cmd []string) (string, error)
Exec a command once inside a container, returning stdout and throwing error on non-zero exit code.
func DockerImagePullWithRetry ¶ added in v1.5.2
func DockerPullImageIfNotCached ¶ added in v0.37.0
func DockerRemoveAll ¶
func DockerRemoveContainers ¶ added in v1.3.2
func DockerRunOnce ¶ added in v0.37.0
Runs a container image exactly once, returning stdout and throwing error on non-zero exit code.
func GetCurrentTimestamp ¶
func GetCurrentTimestamp() string
func GetDenoPath ¶ added in v1.4.7
func GetProjectRoot ¶ added in v1.8.2
If the `os.Getwd()` is within a supabase project, this will return the root of the given project as the current working directory. Otherwise, the `os.Getwd()` is kept as is.
func GetRegistryImageUrl ¶ added in v1.0.1
func GetSupabase ¶ added in v0.38.5
func GetSupabase() *supabase.ClientWithResponses
func GetSupabaseAPIHost ¶ added in v0.31.1
func GetSupabaseAPIHost() string
func GetSupabaseDashboardURL ¶ added in v0.31.1
func GetSupabaseDashboardURL() string
func GetSupabaseDbHost ¶ added in v1.4.10
func GetSupabaseHost ¶ added in v1.10.0
func InstallOrUpgradeDeno ¶ added in v0.19.0
func IsBranchNameReserved ¶ added in v0.13.0
func LoadAccessToken ¶ added in v0.20.0
func LoadConfig ¶
func LoadConfig() error
func LoadConfigFS ¶ added in v0.32.0
func MkdirIfNotExist ¶ added in v0.19.0
func ProcessDiffOutput ¶ added in v0.9.0
func ProcessPullOutput ¶ added in v0.9.0
func ProcessPullOutput(out io.ReadCloser, p Program) error
func ResolveCNAME ¶ added in v1.10.0
func ShowStatus ¶ added in v0.26.0
func ShowStatus()
func ValidateFunctionSlug ¶ added in v0.20.6
Types ¶
type DiffDependencies ¶ added in v0.13.0
type DiffDependencies struct {
Type string `json:"type"`
}
type EnumFlag ¶ added in v0.39.0
Ref: https://github.com/spf13/pflag/issues/236#issuecomment-931600452
type Program ¶ added in v0.17.1
An interface describing the parts of BubbleTea's Program that we actually use.
func NewProgram ¶ added in v0.17.1
func NewProgram(model tea.Model, opts ...tea.ProgramOption) Program
type ProgressMsg ¶ added in v0.9.0
type ProgressMsg *float64
type PromptItem ¶ added in v0.39.0
PromptItem is exposed as prompt input, empty summary + details will be excluded.
func PromptChoice ¶ added in v0.39.0
func PromptChoice(ctx context.Context, title string, items []PromptItem) (PromptItem, error)
Prompt user to choose from a list of items, returns the chosen index.
func (PromptItem) Description ¶ added in v0.39.0
func (i PromptItem) Description() string
func (PromptItem) FilterValue ¶ added in v0.39.0
func (i PromptItem) FilterValue() string
func (PromptItem) Title ¶ added in v0.39.0
func (i PromptItem) Title() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.