Skip to content

Commit

Permalink
fix: fixes for behaviour regressions
Browse files Browse the repository at this point in the history
- 46b7c97. was writing absolute paths
  into `ftl-project.toml`
- `ftl config/secret get` were not writing raw JSON values
  • Loading branch information
alecthomas committed Jun 7, 2024
1 parent 59e5d15 commit 0a8a83d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
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
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

0 comments on commit 0a8a83d

Please sign in to comment.