Skip to content

Commit

Permalink
feat: node18 is now mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarrosop committed Sep 26, 2023
1 parent 4246acf commit 3a3d38b
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 29 deletions.
2 changes: 1 addition & 1 deletion cmd/config/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func commandExample(cCtx *cli.Context) error { //nolint:funlen,maintidx
},
Functions: &model.ConfigFunctions{
Node: &model.ConfigFunctionsNode{
Version: ptr(int(16)),
Version: ptr(int(18)),
},
},
Auth: &model.ConfigAuth{
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/testdata/validate/success/nhost/nhost.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ httpPoolSize = 100

[functions]
[functions.node]
version = 16
version = 18

[auth]
version = '0.20.0'
Expand Down
2 changes: 1 addition & 1 deletion cmd/config/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func expectedConfig() *model.ConfigConfig {
Logs: &model.ConfigHasuraLogs{Level: ptr("warn")},
Events: &model.ConfigHasuraEvents{HttpPoolSize: ptr(uint32(100))},
},
Functions: &model.ConfigFunctions{Node: &model.ConfigFunctionsNode{Version: ptr(16)}},
Functions: &model.ConfigFunctions{Node: &model.ConfigFunctionsNode{Version: ptr(18)}},
Auth: &model.ConfigAuth{
Version: ptr("0.20.0"),
Redirections: &model.ConfigAuthRedirections{
Expand Down
14 changes: 2 additions & 12 deletions cmd/dev/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ const (
flagsFunctionsPort = "functions-port"
flagsHasuraPort = "hasura-port"
flagsHasuraConsolePort = "hasura-console-port"
flagsNode18 = "node18"
)

const (
defaultHTTPPort = 443
defaultPostgresPort = 5432
)

func CommandUp() *cli.Command { //nolint:funlen
func CommandUp() *cli.Command {
return &cli.Command{ //nolint:exhaustruct
Name: "up",
Aliases: []string{},
Expand Down Expand Up @@ -89,11 +88,6 @@ func CommandUp() *cli.Command { //nolint:funlen
Usage: "If specified, expose hasura console on this port. Not recommended",
Value: 0,
},
&cli.BoolFlag{ //nolint:exhaustruct
Name: flagsNode18,
Usage: "Use node 18. Defaults to node 16",
Value: false,
},
},
}
}
Expand Down Expand Up @@ -129,7 +123,6 @@ func commandUp(cCtx *cli.Context) error {
Console: cCtx.Uint(flagsHasuraConsolePort),
Functions: cCtx.Uint(flagsFunctionsPort),
},
cCtx.Bool(flagsNode18),
)
}

Expand Down Expand Up @@ -187,7 +180,6 @@ func up( //nolint:funlen
postgresPort uint,
applySeeds bool,
ports dockercompose.ExposePorts,
useNode18 bool,
) error {
ctx, cancel := context.WithCancel(ctx)

Expand Down Expand Up @@ -215,7 +207,6 @@ func up( //nolint:funlen
ce.Path.DotNhostFolder(),
ce.Path.Root(),
ports,
useNode18,
)
if err != nil {
return fmt.Errorf("failed to generate docker-compose.yaml: %w", err)
Expand Down Expand Up @@ -287,12 +278,11 @@ func Up(
postgresPort uint,
applySeeds bool,
ports dockercompose.ExposePorts,
useNode18 bool,
) error {
dc := dockercompose.New(ce.Path.WorkingDir(), ce.Path.DockerCompose(), ce.ProjectName())

if err := up(
ctx, ce, dc, httpPort, useTLS, postgresPort, applySeeds, ports, useNode18,
ctx, ce, dc, httpPort, useTLS, postgresPort, applySeeds, ports,
); err != nil {
ce.Warnln(err.Error())

Expand Down
10 changes: 1 addition & 9 deletions dockercompose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ func functions( //nolint:funlen
rootFolder string,
jwtSecret string,
port uint,
useNode18 bool,
) *Service {
envVars := map[string]string{
"HASURA_GRAPHQL_ADMIN_SECRET": cfg.Hasura.AdminSecret,
Expand All @@ -319,13 +318,8 @@ func functions( //nolint:funlen
envVars[envVar.GetName()] = envVar.GetValue()
}

image := "nhost/functions:0.1.9"
if useNode18 {
image = "nhost/functions:1.0.0"
}

return &Service{
Image: image,
Image: "nhost/functions:1.0.0",
DependsOn: nil,
EntryPoint: nil,
Command: nil,
Expand Down Expand Up @@ -434,7 +428,6 @@ func ComposeFileFromConfig( //nolint:funlen
dotNhostFolder string,
rootFolder string,
ports ExposePorts,
useNode18 bool,
) (*ComposeFile, error) {
minio, err := minio(dataFolder)
if err != nil {
Expand Down Expand Up @@ -490,7 +483,6 @@ func ComposeFileFromConfig( //nolint:funlen
rootFolder,
jwtSecret,
ports.Functions,
useNode18,
),
"graphql": graphql,
"minio": minio,
Expand Down
2 changes: 1 addition & 1 deletion dockercompose/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func getConfig() *model.ConfigConfig { //nolint:maintidx
},
Functions: &model.ConfigFunctions{
Node: &model.ConfigFunctionsNode{
Version: ptr(16),
Version: ptr(18),
},
},
Hasura: &model.ConfigHasura{
Expand Down
2 changes: 1 addition & 1 deletion examples/myproject/nhost/nhost.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ liveQueriesMultiplexedRefetchInterval = 3000

[functions]
[functions.node]
version = 16
version = 18

[auth]
version = '0.21.2'
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/go-git/go-git/v5 v5.9.0
github.com/google/go-cmp v0.5.9
github.com/hashicorp/go-getter v1.7.2
github.com/nhost/be v0.0.0-20230926093342-5b218de2929f
github.com/nhost/be v0.0.0-20230926115940-c3b7d3961fd7
github.com/pelletier/go-toml/v2 v2.0.8
github.com/urfave/cli/v2 v2.25.7
github.com/wI2L/jsondiff v0.4.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
github.com/nhost/be v0.0.0-20230926093342-5b218de2929f h1:Ws9TS33VKX3w+36k18utttmAeiwFQQBNwEpTz7vLJYU=
github.com/nhost/be v0.0.0-20230926093342-5b218de2929f/go.mod h1:TX+opGjg0+Q7LflEByl4E8B8hlu1huf4t2TY3YzUA9c=
github.com/nhost/be v0.0.0-20230926115940-c3b7d3961fd7 h1:6J7Oh+/KLtLNg6wt8LDMqP+WNBDZsC+dDsIVT3O7W2Q=
github.com/nhost/be v0.0.0-20230926115940-c3b7d3961fd7/go.mod h1:TX+opGjg0+Q7LflEByl4E8B8hlu1huf4t2TY3YzUA9c=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
Expand Down

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

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ github.com/muesli/reflow/wrap
# github.com/muesli/termenv v0.15.2
## explicit; go 1.17
github.com/muesli/termenv
# github.com/nhost/be v0.0.0-20230926093342-5b218de2929f
# github.com/nhost/be v0.0.0-20230926115940-c3b7d3961fd7
## explicit; go 1.21
github.com/nhost/be/services/mimir/model
github.com/nhost/be/services/mimir/schema
Expand Down

0 comments on commit 3a3d38b

Please sign in to comment.