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

fix: fixes for behaviour regressions #1698

Merged
merged 1 commit into from
Jun 7, 2024
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
11 changes: 3 additions & 8 deletions cmd/ftl/cmd_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (

"connectrpc.com/connect"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/admin"
ftlv1 "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1"
cf "github.com/TBD54566975/ftl/common/configuration"
"github.com/alecthomas/types/optional"
)

type configCmd struct {
Expand Down Expand Up @@ -91,13 +92,7 @@ func (s *configGetCmd) Run(ctx context.Context, adminClient admin.Client) error
if err != nil {
return err
}

var value any
err = json.Unmarshal(resp.Msg.Value, &value)
if err != nil {
return fmt.Errorf("%s: %w", s.Ref, err)
}
fmt.Println(value)
fmt.Printf("%s\n", resp.Msg.Value)
return nil
}

Expand Down
7 changes: 1 addition & 6 deletions cmd/ftl/cmd_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,7 @@ func (s *secretGetCmd) Run(ctx context.Context, adminClient admin.Client) error
if err != nil {
return err
}

var value any
if err := json.Unmarshal(resp.Msg.Value, &value); err != nil {
return fmt.Errorf("%s: %w", s.Ref, err)
}
fmt.Println(value)
fmt.Printf("%s\n", resp.Msg.Value)
return nil
}

Expand Down
5 changes: 3 additions & 2 deletions common/projectconfig/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
"path/filepath"
"testing"

in "github.com/TBD54566975/ftl/integration"
"github.com/alecthomas/assert/v2"

in "github.com/TBD54566975/ftl/integration"
)

func TestCmdsCreateProjectTomlFilesIfNonexistent(t *testing.T) {
Expand Down Expand Up @@ -46,6 +47,6 @@ func TestDefaultToRootWhenModuleDirsMissing(t *testing.T) {

func TestConfigCmdWithoutController(t *testing.T) {
in.RunWithoutController(t, "configs-ftl-project.toml",
in.ExecWithExpectedOutput("value\n", "ftl", "config", "get", "key"),
in.ExecWithExpectedOutput("\"value\"\n", "ftl", "config", "get", "key"),
)
}
15 changes: 0 additions & 15 deletions common/projectconfig/projectconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,6 @@ func loadFile(path string) (Config, error) {
}
return Config{}, fmt.Errorf("unknown configuration keys: %s", strings.Join(keys, ", "))
}

// make modules-dir absolute to mimic the behavior of the CLI
for i, dir := range config.ModuleDirs {
if !filepath.IsAbs(dir) {
config.ModuleDirs[i] = filepath.Join(filepath.Dir(path), dir)
}
}

// make external-dirs absolute to mimic the behavior of the CLI
for i, dir := range config.ExternalDirs {
if !filepath.IsAbs(dir) {
config.ExternalDirs[i] = filepath.Join(filepath.Dir(path), dir)
}
}

return config, nil
}

Expand Down
4 changes: 2 additions & 2 deletions common/projectconfig/projectconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func TestProjectConfig(t *testing.T) {
},
},
},
ModuleDirs: []string{"testdata/a/b/c", "testdata/d"},
ExternalDirs: []string{"testdata/e/f", "testdata/g/h"},
ModuleDirs: []string{"a/b/c", "d"},
ExternalDirs: []string{"e/f", "g/h"},
Commands: Commands{
Startup: []string{"echo 'Executing global pre-build command'"},
},
Expand Down
Loading