Skip to content

Update mailpit label for supabase status in terminal and other reference to inbucket #3609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/templates/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ supabase-status:
GraphQL URL: http://127.0.0.1:54321/graphql/v1
DB URL: postgresql://postgres:[email protected]:54322/postgres
Studio URL: http://127.0.0.1:54323
Inbucket URL: http://127.0.0.1:54324
Mailpit URL: http://127.0.0.1:54324
JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
anon key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
service_role key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
Expand All @@ -91,15 +91,15 @@ supabase-status:
API_URL="http://127.0.0.1:54321"
DB_URL="postgresql://postgres:[email protected]:54322/postgres"
GRAPHQL_URL="http://127.0.0.1:54321/graphql/v1"
INBUCKET_URL="http://127.0.0.1:54324"
Mailpit_URL="http://127.0.0.1:54324"
JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long"
SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU"
STUDIO_URL="http://127.0.0.1:54323"
- id: output-custom-name
name: Customize the names of exported variables
code: supabase status -o env --override-name auth.anon_key=SUPABASE_ANON_KEY --override-name auth.service_role_key=SUPABASE_SERVICE_KEY
response: |
Stopped services: [supabase_inbucket_cli supabase_rest_cli supabase_studio_cli]
Stopped services: [supabase_Mailpit_cli supabase_rest_cli supabase_studio_cli]
SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
DB_URL="postgresql://postgres:[email protected]:54322/postgres"
GRAPHQL_URL="http://127.0.0.1:54321/graphql/v1"
Expand Down
30 changes: 15 additions & 15 deletions internal/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,12 @@ EOF
fmt.Sprintf("GOTRUE_SMTP_ADMIN_EMAIL=%s", utils.Config.Auth.Email.Smtp.AdminEmail),
fmt.Sprintf("GOTRUE_SMTP_SENDER_NAME=%s", utils.Config.Auth.Email.Smtp.SenderName),
)
} else if utils.Config.Inbucket.Enabled {
} else if utils.Config.Mailpit.Enabled {
env = append(env,
"GOTRUE_SMTP_HOST="+utils.InbucketId,
"GOTRUE_SMTP_HOST="+utils.MailpitId,
"GOTRUE_SMTP_PORT=1025",
fmt.Sprintf("GOTRUE_SMTP_ADMIN_EMAIL=%s", utils.Config.Inbucket.AdminEmail),
fmt.Sprintf("GOTRUE_SMTP_SENDER_NAME=%s", utils.Config.Inbucket.SenderName),
fmt.Sprintf("GOTRUE_SMTP_ADMIN_EMAIL=%s", utils.Config.Mailpit.AdminEmail),
fmt.Sprintf("GOTRUE_SMTP_SENDER_NAME=%s", utils.Config.Mailpit.SenderName),
)
}

Expand Down Expand Up @@ -703,35 +703,35 @@ EOF
}

// Start Mailpit
if utils.Config.Inbucket.Enabled && !isContainerExcluded(utils.Config.Inbucket.Image, excluded) {
inbucketPortBindings := nat.PortMap{"8025/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Port), 10)}}}
if utils.Config.Inbucket.SmtpPort != 0 {
inbucketPortBindings["1025/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.SmtpPort), 10)}}
if utils.Config.Mailpit.Enabled && !isContainerExcluded(utils.Config.Mailpit.Image, excluded) {
mailpitPortBindings := nat.PortMap{"8025/tcp": []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Mailpit.Port), 10)}}}
if utils.Config.Mailpit.SmtpPort != 0 {
mailpitPortBindings["1025/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Mailpit.SmtpPort), 10)}}
}
if utils.Config.Inbucket.Pop3Port != 0 {
inbucketPortBindings["1110/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Inbucket.Pop3Port), 10)}}
if utils.Config.Mailpit.Pop3Port != 0 {
mailpitPortBindings["1110/tcp"] = []nat.PortBinding{{HostPort: strconv.FormatUint(uint64(utils.Config.Mailpit.Pop3Port), 10)}}
}
if _, err := utils.DockerStart(
ctx,
container.Config{
Image: utils.Config.Inbucket.Image,
Image: utils.Config.Mailpit.Image,
},
container.HostConfig{
PortBindings: inbucketPortBindings,
PortBindings: mailpitPortBindings,
RestartPolicy: container.RestartPolicy{Name: "always"},
},
network.NetworkingConfig{
EndpointsConfig: map[string]*network.EndpointSettings{
utils.NetId: {
Aliases: utils.InbucketAliases,
Aliases: utils.MailpitAliases,
},
},
},
utils.InbucketId,
utils.MailpitId,
); err != nil {
return err
}
started = append(started, utils.InbucketId)
started = append(started, utils.MailpitId)
}

// Start Realtime.
Expand Down
6 changes: 3 additions & 3 deletions internal/start/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ func TestDatabaseStart(t *testing.T) {
utils.Config.Auth.Email.DoubleConfirmChanges = true
utils.Config.Auth.Email.EnableConfirmations = true
apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.Config.Auth.Image), utils.GotrueId)
utils.InbucketId = "test-inbucket"
apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.Config.Inbucket.Image), utils.InbucketId)
utils.MailpitId = "test-mailpit"
apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.Config.Mailpit.Image), utils.MailpitId)
utils.RealtimeId = "test-realtime"
apitest.MockDockerStart(utils.Docker, utils.GetRegistryImageUrl(utils.Config.Realtime.Image), utils.RealtimeId)
utils.RestId = "test-rest"
Expand All @@ -164,7 +164,7 @@ func TestDatabaseStart(t *testing.T) {
defer conn.Close(t)
// Setup health probes
started := []string{
utils.DbId, utils.KongId, utils.GotrueId, utils.InbucketId, utils.RealtimeId,
utils.DbId, utils.KongId, utils.GotrueId, utils.MailpitId, utils.RealtimeId,
utils.StorageId, utils.ImgProxyId, utils.EdgeRuntimeId, utils.PgmetaId, utils.StudioId,
utils.LogflareId, utils.RestId, utils.VectorId,
}
Expand Down
8 changes: 4 additions & 4 deletions internal/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
StorageS3URL string `env:"api.storage_s3_url,default=STORAGE_S3_URL"`
DbURL string `env:"db.url,default=DB_URL"`
StudioURL string `env:"studio.url,default=STUDIO_URL"`
InbucketURL string `env:"inbucket.url,default=INBUCKET_URL"`
MailpitURL string `env:"mailpit.url,default=MAILPIT_URL"`

Check failure on line 32 in internal/status/status.go

View workflow job for this annotation

GitHub Actions / Lint

File is not properly formatted (gofmt)
JWTSecret string `env:"auth.jwt_secret,default=JWT_SECRET"`
AnonKey string `env:"auth.anon_key,default=ANON_KEY"`
ServiceRoleKey string `env:"auth.service_role_key,default=SERVICE_ROLE_KEY"`
Expand All @@ -54,8 +54,8 @@
values[c.AnonKey] = utils.Config.Auth.AnonKey.Value
values[c.ServiceRoleKey] = utils.Config.Auth.ServiceRoleKey.Value
}
if utils.Config.Inbucket.Enabled && !utils.SliceContains(exclude, utils.InbucketId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Inbucket.Image)) {
values[c.InbucketURL] = fmt.Sprintf("http://%s:%d", utils.Config.Hostname, utils.Config.Inbucket.Port)
if utils.Config.Mailpit.Enabled && !utils.SliceContains(exclude, utils.MailpitId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Mailpit.Image)) {
values[c.MailpitURL] = fmt.Sprintf("http://%s:%d", utils.Config.Hostname, utils.Config.Mailpit.Port)
}
if utils.Config.Storage.Enabled && !utils.SliceContains(exclude, utils.StorageId) && !utils.SliceContains(exclude, utils.ShortContainerImageName(utils.Config.Storage.Image)) {
values[c.StorageS3URL] = utils.GetApiUrl("/storage/v1/s3")
Expand Down Expand Up @@ -209,7 +209,7 @@
StorageS3URL: " " + utils.Aqua("S3 Storage URL"),
DbURL: " " + utils.Aqua("DB URL"),
StudioURL: " " + utils.Aqua("Studio URL"),
InbucketURL: " " + utils.Aqua("Inbucket URL"),
MailpitURL: " " + utils.Aqua("Mailpit URL"),
JWTSecret: " " + utils.Aqua("JWT secret"),
AnonKey: " " + utils.Aqua("anon key"),
ServiceRoleKey: "" + utils.Aqua("service_role key"),
Expand Down
2 changes: 1 addition & 1 deletion internal/status/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func TestPrintStatus(t *testing.T) {
utils.Config.Realtime.Enabled = false
utils.Config.Studio.Enabled = false
utils.Config.Analytics.Enabled = false
utils.Config.Inbucket.Enabled = false
utils.Config.Mailpit.Enabled = false

t.Run("outputs env var", func(t *testing.T) {
utils.Config.Hostname = "127.0.0.1"
Expand Down
4 changes: 2 additions & 2 deletions internal/stop/stop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func TestStopServices(t *testing.T) {
utils.ConfigId = "test-config"
utils.StorageId = "test-storage"
utils.EdgeRuntimeId = "test-functions"
utils.InbucketId = "test-inbucket"
utils.MailpitId = "test-mailpit"
// Setup mock docker
require.NoError(t, apitest.MockDocker(utils.Docker))
defer gock.OffAll()
Expand All @@ -211,7 +211,7 @@ func TestStopServices(t *testing.T) {
utils.ConfigId = "test-config"
utils.StorageId = "test-storage"
utils.EdgeRuntimeId = "test-functions"
utils.InbucketId = "test-inbucket"
utils.MailpitId = "test-mailpit"
// Setup mock docker
require.NoError(t, apitest.MockDocker(utils.Docker))
require.NoError(t, client.WithVersion("1.41")(utils.Docker))
Expand Down
8 changes: 4 additions & 4 deletions internal/utils/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ConfigId string
KongId string
GotrueId string
InbucketId string
MailpitId string
RealtimeId string
RestId string
StorageId string
Expand All @@ -36,7 +36,7 @@
DbAliases = []string{"db", "db.supabase.internal"}
KongAliases = []string{"kong", "api.supabase.internal"}
GotrueAliases = []string{"auth"}
InbucketAliases = []string{"inbucket"}
MailpitAliases = []string{"mailpit"}

Check failure on line 39 in internal/utils/config.go

View workflow job for this annotation

GitHub Actions / Lint

File is not properly formatted (gofmt)
RealtimeAliases = []string{"realtime", Config.Realtime.TenantId}
RestAliases = []string{"rest"}
StorageAliases = []string{"storage"}
Expand Down Expand Up @@ -66,7 +66,7 @@
ConfigId = GetId("config")
KongId = GetId(KongAliases[0])
GotrueId = GetId(GotrueAliases[0])
InbucketId = GetId(InbucketAliases[0])
MailpitId = GetId(MailpitAliases[0])
RealtimeId = GetId(RealtimeAliases[0])
RestId = GetId(RestAliases[0])
StorageId = GetId(StorageAliases[0])
Expand All @@ -84,7 +84,7 @@
return []string{
KongId,
GotrueId,
InbucketId,
MailpitId,
RealtimeId,
RestId,
StorageId,
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestUpdateDockerIds(t *testing.T) {
assert.Equal(t, "supabase_db_test-project", DbId)
assert.Equal(t, "supabase_kong_test-project", KongId)
assert.Equal(t, "supabase_auth_test-project", GotrueId)
assert.Equal(t, "supabase_inbucket_test-project", InbucketId)
assert.Equal(t, "supabase_mailpit_test-project", MailpitId)
assert.Equal(t, "supabase_realtime_test-project", RealtimeId)
assert.Equal(t, "supabase_rest_test-project", RestId)
assert.Equal(t, "supabase_storage_test-project", StorageId)
Expand Down
14 changes: 7 additions & 7 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ type (
Db db `toml:"db"`
Realtime realtime `toml:"realtime"`
Studio studio `toml:"studio"`
Inbucket inbucket `toml:"inbucket"`
Mailpit mailpit `toml:"mailpit"`
Storage storage `toml:"storage"`
Auth auth `toml:"auth"`
EdgeRuntime edgeRuntime `toml:"edge_runtime"`
Expand Down Expand Up @@ -199,7 +199,7 @@ type (
PgmetaImage string `toml:"-"`
}

inbucket struct {
mailpit struct {
Enabled bool `toml:"enabled"`
Image string `toml:"-"`
Port uint16 `toml:"port"`
Expand Down Expand Up @@ -379,8 +379,8 @@ func NewConfig(editors ...ConfigEditor) config {
Value: defaultJwtSecret,
},
},
Inbucket: inbucket{
Image: Images.Inbucket,
Mailpit: mailpit{
Image: Images.Mailpit,
AdminEmail: "[email protected]",
SenderName: "Admin",
},
Expand Down Expand Up @@ -792,9 +792,9 @@ func (c *config) Validate(fsys fs.FS) error {
}
}
// Validate smtp config
if c.Inbucket.Enabled {
if c.Inbucket.Port == 0 {
return errors.New("Missing required field in config: inbucket.port")
if c.Mailpit.Enabled {
if c.Mailpit.Port == 0 {
return errors.New("Missing required field in config: mailpit.port")
}
}
// Validate auth config
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Pg string `mapstructure:"pg"`
// Append to Services when adding new dependencies below
Kong string `mapstructure:"kong"`
Inbucket string `mapstructure:"mailpit"`
Mailpit string `mapstructure:"mailpit"`

Check failure on line 22 in pkg/config/constants.go

View workflow job for this annotation

GitHub Actions / Lint

File is not properly formatted (gofmt)
Postgrest string `mapstructure:"postgrest"`
Pgmeta string `mapstructure:"pgmeta"`
Studio string `mapstructure:"studio"`
Expand Down Expand Up @@ -64,7 +64,7 @@
s.Storage,
s.ImgProxy,
s.Kong,
s.Inbucket,
s.Mailpit,
s.Postgrest,
s.Pgmeta,
s.Studio,
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/templates/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ openai_api_key = "env(OPENAI_API_KEY)"

# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
[inbucket]
[mailpit]
enabled = true
# Port to use for the email testing server web interface.
port = 54324
# Uncomment to expose additional ports for testing user applications that send emails.
# smtp_port = 54325
# pop3_port = 54326
# smtp_port = 1025
# pop3_port = 1110
# admin_email = "[email protected]"
# sender_name = "Admin"

Expand Down
6 changes: 3 additions & 3 deletions pkg/config/testdata/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ openai_api_key = "env(OPENAI_API_KEY)"

# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
[inbucket]
[mailpit]
enabled = true
# Port to use for the email testing server web interface.
port = 54324
# Uncomment to expose additional ports for testing user applications that send emails.
# smtp_port = 54325
# pop3_port = 54326
# smtp_port = 1025
# pop3_port = 1110
# admin_email = "[email protected]"
# sender_name = "Admin"

Expand Down
Loading