Skip to content
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

feat: added NEXT_PUBLIC_LOCAL_PROJECT_CONFIG to the dashboard #813

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ certbot certonly \
-d local.hasura.nhost.run \
-d local.auth.nhost.run \
-d local.storage.nhost.run \
-d local.dashboard.nhost.run \
-d local.functions.nhost.run \
-m '[email protected]' \
--non-interactive \
Expand Down
23 changes: 17 additions & 6 deletions dockercompose/compose.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dockercompose

import (
"encoding/json"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -255,15 +256,20 @@ func dashboard(
dashboardVersion string,
httpPort uint,
useTLS bool,
) *Service {
) (*Service, error) {
b, err := json.Marshal(cfg)
if err != nil {
return nil, fmt.Errorf("failed to marshal config: %w", err)
}
return &Service{
Image: dashboardVersion,
DependsOn: nil,
EntryPoint: nil,
Command: nil,
Environment: map[string]string{
"NEXT_PUBLIC_NHOST_ADMIN_SECRET": cfg.Hasura.AdminSecret,
"NEXT_PUBLIC_NHOST_AUTH_URL": URL("auth", httpPort, useTLS) + "/v1",
"NEXT_PUBLIC_LOCAL_PROJECT_CONFIG": string(b),
"NEXT_PUBLIC_NHOST_ADMIN_SECRET": cfg.Hasura.AdminSecret,
"NEXT_PUBLIC_NHOST_AUTH_URL": URL("auth", httpPort, useTLS) + "/v1",
"NEXT_PUBLIC_NHOST_FUNCTIONS_URL": URL(
"functions",
httpPort,
Expand Down Expand Up @@ -294,7 +300,7 @@ func dashboard(
Restart: "",
Volumes: []Volume{},
WorkingDir: new(string),
}
}, nil
}

func functions( //nolint:funlen
Expand Down Expand Up @@ -430,7 +436,7 @@ func sanitizeBranch(name string) string {
return strings.ToLower(re.ReplaceAllString(name, ""))
}

func ComposeFileFromConfig( //nolint:funlen
func ComposeFileFromConfig( //nolint:funlen,cyclop
cfg *model.ConfigConfig,
projectName string,
httpPort uint,
Expand Down Expand Up @@ -486,12 +492,17 @@ func ComposeFileFromConfig( //nolint:funlen
return nil, err
}

dashboard, err := dashboard(cfg, dashboardVersion, httpPort, useTLS)
if err != nil {
return nil, fmt.Errorf("failed to create dashboard service: %w", err)
}

c := &ComposeFile{
Version: "3.8",
Services: map[string]*Service{
"auth": auth,
"console": console,
"dashboard": dashboard(cfg, dashboardVersion, httpPort, useTLS),
"dashboard": dashboard,
"functions": functions(
cfg,
httpPort,
Expand Down
1 change: 0 additions & 1 deletion nhostclient/graphql/client_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion nhostclient/graphql/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading