Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
Merged
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
22 changes: 18 additions & 4 deletions cmd/dev/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (
flagsFunctionsPort = "functions-port"
flagsHasuraPort = "hasura-port"
flagsHasuraConsolePort = "hasura-console-port"
flagDashboardPort = "dashboard-port"
flagMailhogPort = "mailhog-port"
flagDashboardVersion = "dashboard-version"
flagConfigserverImage = "configserver-image"
flagRunService = "run-service"
Expand Down Expand Up @@ -107,6 +109,16 @@ func CommandUp() *cli.Command { //nolint:funlen
Usage: "If specified, expose hasura console on this port. Not recommended",
Value: 0,
},
&cli.UintFlag{ //nolint:exhaustruct
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env var fallbacks (NHOST_DASHBOARD_PORT) are mentioned in the PR description but not implemented; add EnvVars: []string{"NHOST_DASHBOARD_PORT"} to this flag.

Copilot uses AI. Check for mistakes.
Name: flagDashboardPort,
Usage: "If specified, expose dashboard on this port. Not recommended",
Value: 0,
},
&cli.UintFlag{ //nolint:exhaustruct
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Env var fallbacks (NHOST_MAILHOG_PORT) are mentioned in the PR description but not implemented; add EnvVars: []string{"NHOST_MAILHOG_PORT"} to this flag.

Copilot uses AI. Check for mistakes.
Name: flagMailhogPort,
Usage: "If specified, expose mailhog on this port. Not recommended",
Value: 0,
},
&cli.StringFlag{ //nolint:exhaustruct
Name: flagDashboardVersion,
Usage: "Dashboard version to use",
Expand Down Expand Up @@ -174,6 +186,8 @@ func commandUp(cCtx *cli.Context) error {
Graphql: cCtx.Uint(flagsHasuraPort),
Console: cCtx.Uint(flagsHasuraConsolePort),
Functions: cCtx.Uint(flagsFunctionsPort),
Dashboard: cCtx.Uint(flagDashboardPort),
Mailhog: cCtx.Uint(flagMailhogPort),
},
cCtx.String(flagDashboardVersion),
configserverImage,
Expand Down Expand Up @@ -441,10 +455,10 @@ func printInfo(
subdomain, "storage", httpPort, useTLS))
fmt.Fprintf(w, "- Functions:\t\t%s\n", dockercompose.URL(
subdomain, "functions", httpPort, useTLS))
fmt.Fprintf(w, "- Dashboard:\t\t%s\n", dockercompose.URL(
subdomain, "dashboard", httpPort, useTLS))
fmt.Fprintf(w, "- Mailhog:\t\t%s\n", dockercompose.URL(
subdomain, "mailhog", httpPort, useTLS))
fmt.Fprintf(w, "- Dashboard:\t\t%s\n", dockercompose.URL(
subdomain, "dashboard", httpPort, useTLS))
fmt.Fprintf(w, "- Mailhog:\t\t%s\n", dockercompose.URL(
subdomain, "mailhog", httpPort, useTLS))

for _, svc := range runServices {
for _, port := range svc.Config.GetPorts() {
Expand Down
13 changes: 8 additions & 5 deletions dockercompose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ func dashboard(
dashboardVersion string,
httpPort uint,
useTLS bool,
port uint,
) *Service {
return &Service{
Image: dashboardVersion,
Expand Down Expand Up @@ -355,7 +356,7 @@ func dashboard(
Rewrite: nil,
},
}.Labels(),
Ports: []Port{},
Ports: ports(port, dashboardPort),
Restart: "",
Volumes: []Volume{},
WorkingDir: new(string),
Expand Down Expand Up @@ -444,7 +445,7 @@ func functions( //nolint:funlen
}
}

func mailhog(subdomain, volumeName string, useTLS bool) *Service {
func mailhog(subdomain, volumeName string, useTLS bool, port uint) *Service {
return &Service{
Image: "jcalonso/mailhog:v1.0.1",
DependsOn: nil,
Expand All @@ -469,7 +470,7 @@ func mailhog(subdomain, volumeName string, useTLS bool) *Service {
Rewrite: nil,
},
}.Labels(),
Ports: nil,
Ports: ports(port, mailhogPort),
Restart: "always",
Volumes: []Volume{
{
Expand All @@ -489,6 +490,8 @@ type ExposePorts struct {
Graphql uint
Console uint
Functions uint
Dashboard uint
Mailhog uint
}

func sanitizeBranch(name string) string {
Expand Down Expand Up @@ -557,11 +560,11 @@ func getServices( //nolint: funlen,cyclop
}

mailhogVolumeName := "mailhog_" + sanitizeBranch(branch)
mailhog := mailhog(subdomain, mailhogVolumeName, useTLS)
mailhog := mailhog(subdomain, mailhogVolumeName, useTLS, ports.Mailhog)

services := map[string]*Service{
"console": console,
"dashboard": dashboard(cfg, subdomain, dashboardVersion, httpPort, useTLS),
"dashboard": dashboard(cfg, subdomain, dashboardVersion, httpPort, useTLS, ports.Dashboard),
"graphql": graphql,
"minio": minio,
"postgres": postgres,
Expand Down
Loading